home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / chasm.dqc / CHASM.DOC
Text File  |  1984-06-14  |  106KB  |  4,423 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                         READ
  8.                                         THIS
  9.                                        BEFORE
  10.                                       PRINTING!!!!
  11.  
  12.  
  13.  
  14.       This document has been formatted in a special way. Virtually all dot
  15.       matrix printers have a condensed mode which prints 132 characters
  16.       across a standard 8 1/2 inch page.  When this file is printed out in
  17.       condensed mode, the resulting printed pages can be cut down to 5 1/2 X
  18.       8 1/2 inches.  The cut pages will fit nicely in the back of your
  19.       DOS manual for storage.
  20.  
  21.       Typically, you can turn on this mode by sending a special control
  22.       sequence to the printer from BASIC.  For example, you can turn on the
  23.       condensed mode of the IBM/Epson printer with the BASIC statement:
  24.       LPRINT chr$(15).  If your printer has such a condensed mode, turn it
  25.       on now, before printing the rest of this document.
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.                                          (tm)
  81.                                     CHASM
  82.  
  83.                                Cheap Assembler
  84.                         for the IBM Personal Computer
  85.  
  86.                                 User's Manual
  87.                           (c) 1983 by David Whitman
  88.                               Versions 2.13/3.14
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.       David Whitman
  109.       136 Wellington Terrace
  110.       Lansdale, PA 19446
  111.  
  112.       (215) 641-7114 (days)
  113.       (215) 362-8526 (evenings)
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                         Table of Contents
  137.  
  138.       Why CHASM?..................................................1
  139.  
  140.       What can CHASM do?..........................................2
  141.  
  142.       What WON'T it do?...........................................2
  143.  
  144.       The Two Versions of CHASM...................................3
  145.  
  146.       Setting Up a CHASM Work Disk................................4
  147.  
  148.       Modifying CHASM's I/O Defaults..............................6
  149.  
  150.       Syntax......................................................9
  151.  
  152.       Labels.....................................................11
  153.  
  154.       Operands...................................................14
  155.  
  156.       Resolution of Ambiguities..................................19
  157.  
  158.       Pseudo-Operations..........................................22
  159.  
  160.       Structures.................................................28
  161.  
  162.       Outside the Program Segment................................32
  163.  
  164.       Running CHASM..............................................33
  165.  
  166.       Error and Diagnostic Messages..............................36
  167.  
  168.       Execution of Assembled Programs............................40
  169.  
  170.       Notes for Those Upgrading to This Version of CHASM.........44
  171.  
  172.       Miscellaneous and A Word From Our Sponsor..................47
  173.  
  174.       Appendix A: Mnemonic List..................................51
  175.  
  176.       Appendix B: Differences Between CHASM and TOA..............53
  177.  
  178.       Appendix C: Description of Files...........................59
  179.  
  180.       Compiled Version Order Form................................60
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                                                                       1
  267.  
  268.       >>Why CHASM?<<
  269.  
  270.       Why go to the trouble to write an assembler, when one already
  271.       exists?  The IBM Macro Assembler is a very powerful software tool
  272.       available off the shelf.  It supports features such as macros,
  273.       multiple segments, and linking to external procedures.
  274.  
  275.       Unfortunately, the cost of all this power is complexity. The
  276.       macro assembler is so complicated that IBM warns beginners it is
  277.       only suitable for "experienced assembly language programmers".
  278.  
  279.       For most users, this sophistication is more of a hindrance than
  280.       an aid.  Even when writing short, simple programs, the user is
  281.       saddled with a set of confusing pseudo-ops only appropriate for
  282.       large, multi-segment programs.  Producing a fast loading
  283.       executable file requires running three separate programs (MASM,
  284.       LINK and EXE2BIN) before you can get down to testing.
  285.  
  286.       The macro assembler is totally unsuitable for use with BASIC.
  287.       Although it is *possible* to produce machine language subroutines
  288.       for BASIC with the macro assembler, the process is incredibly
  289.       convoluted and confusing.
  290.  
  291.       To top it all off, the macro assembler costs an overpriced $100.
  292.  
  293.       CHASM is, I hope, a more reasonable compromise between power and
  294.       accessibility.  CHASM is simple to use and understand.  Unlike
  295.       the macro assembler, CHASM doesn't require a second LINK step to
  296.       produce a working program.  CHASM also produces fast loading
  297.       programs without the use of the utility EXE2BIN.
  298.  
  299.       CHASM supports two different, simple mechanisms for getting
  300.       machine language routines into BASIC, the most popular language
  301.       for the IBM Personal Computer.
  302.  
  303.       Finally, the suggested donation for CHASM is a modest $30.
  304.  
  305.       A Note for Beginners:
  306.  
  307.       Before going on, you might find it useful to print and read the
  308.       file PRIMER.DOC, included on your CHASM disk.  PRIMER is a gentle
  309.       introduction to assembly language, which will teach you some of
  310.       the vocabulary and key concepts you will need to start out with.
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                                                       2
  333.  
  334.       >>What can CHASM do?<<
  335.  
  336.       CHASM takes a text file, consisting of mnemonics, user-defined
  337.       symbols, numbers, and pseudo-ops, and produces a file of
  338.       corresponding machine language for the 8088 processor.  CHASM
  339.       allows you to define labels for branching, rather than requiring
  340.       you to figure out offsets or addresses to jump to.  It allows you
  341.       to represent with a name any constants you want to use, making
  342.       your programs easier to understand.  Most importantly, it
  343.       translates assembly language mnemonics to their machine language
  344.       equivalents freeing you from the task of hand translation.
  345.  
  346.       >>What WON'T it do?<<
  347.  
  348.       In the interest of simplicity, CHASM has a number of
  349.       restrictions:
  350.  
  351.       1. Macros are not supported.
  352.  
  353.       2. Arithmetic expressions within operand lists are not supported,
  354.          at least in the current release.
  355.  
  356.       3. Multiple segment definitions are not allowed. CHASM assumes
  357.          that your entire program fits in one segment, that the cs, ds,
  358.          and es registers all point to this same segment, and that the
  359.          ss register points to a valid stack area.  An equivalent
  360.          statement is that CHASM produces COM files, not EXE files.
  361.  
  362.       4. Linking is not supported.  Programs produced by CHASM must
  363.          either be stand-alone units, or subroutines called from BASIC
  364.          programs (either interpreted or compiled).  You can't use
  365.          CHASM to produce object modules to link into Pascal or FORTRAN
  366.          programs.
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                                                       3
  399.  
  400.       >>The Two Versions of CHASM<<
  401.  
  402.       CHASM is available in two flavors, interpreted and compiled.
  403.       You can tell which version you have by listing the directory of
  404.       you CHASM disk.  If the file CHASM.EXE is present, you have the
  405.       compiled version, otherwise you have the interpreted version.
  406.  
  407.       The interpreted version is the "budget" release.  It's much
  408.       slower, and doesn't support all the advanced features of the
  409.       compiled version.  The advantages of the interpreted version are
  410.       that it is available for free trial under the Freeware (tm)
  411.       plan, and requires only 64K to run.
  412.  
  413.       The compiled version is the "deluxe" release.  It clocks in about
  414.       six times faster, and supports a number of bells and whistles not
  415.       offered in the interpreted version.  This version of CHASM
  416.       requires 128K to run, and is only available to those who support
  417.       CHASM's development by sending a payment of $30 or more.  An
  418.       order form for the compiled version is included at the end of
  419.       this document.
  420.  
  421.       Throughout this document, advanced features supported only by the
  422.       compiled version will be marked as follows:
  423.  
  424.         ==>Compiled version only.
  425.  
  426.       Attempts to use these features in the interpreted version will
  427.       generally result in error messages, with the advanced feature
  428.       otherwise being ignored; however, unpredictable behavior could
  429.       result in some instances.
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                                                       4
  465.  
  466.       >>SETTING UP A CHASM WORK DISK<<
  467.  
  468.       CHASM comes in two flavors: interpreted and compiled.  You can
  469.       tell which version you have by listing the directory of your
  470.       CHASM distribution disk.  If the file CHASM.EXE is present, you
  471.       have the compiled version.  If not, you have the interpreted
  472.       version.  Follow the appropriate instructions below to make a
  473.       CHASM work disk:
  474.  
  475.       Compiled version:
  476.  
  477.       Format a fresh diskette with the /S option (to include DOS). Now
  478.       copy the following files from your CHASM distribution disk:
  479.  
  480.          CHASM.EXE
  481.          CHASM128.DAT
  482.  
  483.       Interpreted version:
  484.  
  485.       Format a fresh diskette with the /S option (to include DOS). From
  486.       your master DOS diskette, copy the file:
  487.  
  488.          BASIC.COM
  489.  
  490.       Now copy the following files from your CHASM distribution disk:
  491.  
  492.          CHASM.BAT
  493.          CHASM.BAS
  494.          CHASM.DAT
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                                                                       5
  531.  
  532.       Both versions:
  533.  
  534.       The file CLEAR.ASM on your CHASM distribution disk is provided as
  535.       a sample assembly language source file.  If you want to try out
  536.       CHASM before writing a source program of your own, copy CLEAR.ASM
  537.       onto your work disk.
  538.  
  539.       If you wish to change any of CHASM's assumptions about your
  540.       printer or monitor, you should include a CHASM.CFG file on your
  541.       work disk.  See the section titled "Modifying CHASM's I/O
  542.       Defaults" for a discussion of the CHASM.CFG file.
  543.  
  544.       You may find it convenient to keep a copy of your text editor
  545.       (EDLIN, VEDIT, etc.) on your work diskette, for creation and
  546.       modification of source files.
  547.  
  548.       If you plan to incorporate machine language routines in BASIC
  549.       programs, copy the utility program COM2DATA (file COM2DATA.EXE or
  550.       COM2DATA.BAS) from your CHASM distribution disk.
  551.  
  552.       DOS 2.0 users: a high speed, DOS 2.0 filter version of COM2DATA
  553.       is now available.  Check your disk for the file COM2DATA.ASM and
  554.       assemble it with CHASM before use.
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.                                                                       6
  597.  
  598.       >>MODIFYING CHASM'S I/O DEFAULTS<<
  599.  
  600.       CHASM supports the use of a configuration file, which can be used
  601.       to override some of CHASM's default assumptions about your printer
  602.       and video monitor.  If you are willing to accept CHASM's
  603.       defaults, you may skip this section - CHASM will work perfectly
  604.       well without the file described below.
  605.  
  606.       The configuration process involves supplying a file named
  607.       CHASM.CFG on your work disk.  The file should contain a series of
  608.       text "switches" of the following form:
  609.  
  610.       /SWITCH, nn [, mm, oo,...]
  611.  
  612.       Where "/SWITCH" is a reserved word, listed below, and nn, mm, oo
  613.       are numbers.  The reserved word must be in all caps.  The
  614.       brackets around mm and oo indicate that these numbers are
  615.       optional - don't put brackets in CHASM.CFG.  Each number or word
  616.       should be separated by a comma or should start a new line.
  617.  
  618.       The following switches are implemented:
  619.  
  620.       /132        Printer 132 column mode.  The numbers following this
  621.                   switch are the ASCII codes for the characters which
  622.                   cause your printer to go into condensed mode.  You
  623.                   may specify as many characters as you like.  If you
  624.                   don't provide this switch, CHASM will truncate source
  625.                   lines in listings to avoid going over 80 columns.
  626.  
  627.                   You can also include characters to activate any other
  628.                   special features of your printer you want CHASM to
  629.                   turn on before printing.  Example: (for IBM printer)
  630.  
  631.                   /132, 15
  632.  
  633.       /80         Printer 80 column mode.  Similar to /132, but the
  634.                   numbers represent the characters to return your
  635.                   printer to normal.  Include the codes for any
  636.                   characters you want CHASM to send to your printer
  637.                   before returning you to DOS.  The following example
  638.                   turns off condensed mode and causes a form feed on
  639.                   the IBM printer:
  640.  
  641.                   /80, 18, 12
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.                                                                       7
  663.  
  664.       /BEEP       Enables/Disables audible warning when errors are
  665.                   discovered in your source program.  A value of zero
  666.                   turns off beeping, anything else turns it on.
  667.                   Example: (off)
  668.  
  669.                   /BEEP, 0
  670.  
  671.       /FG         Foreground color.  Users with color monitors may
  672.                   select a foreground color from the following list:
  673.  
  674.                   0    Black               8    Gray
  675.                   1    Blue                9    Light Blue
  676.                   2    Green              10    Light Green
  677.                   3    Cyan               11    Light Cyan
  678.                   4    Red                12    Light Red
  679.                   5    Magenta            13    Light Magenta
  680.                   6    Brown              14    Yellow
  681.                   7    White              15    High Intensity White
  682.  
  683.                   Example: (Magenta)
  684.  
  685.                   /FG, 5
  686.  
  687.       /BG         Background color.  Selections 0-7 above are
  688.                   available. Example: (Cyan)
  689.  
  690.                   /BG, 3
  691.  
  692.  
  693.       /PAGELEN    CHASM assumes that there are 66 lines to each
  694.                   printed page.  If you use different sized paper,
  695.                   enter the number of lines per page after this switch.
  696.                   Example: (European standard)
  697.  
  698.                   /PAGELEN, 72
  699.  
  700.       /LINES      By default, CHASM will print 58 lines on each printed
  701.                   page, then skip over the perforation to the next
  702.                   page.  You can change this number to suit your paper
  703.                   and personal taste.  Example:
  704.  
  705.                   /LINES, 50
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.                                                                       8
  729.  
  730.  
  731.       A sample CHASM.CFG file, suitable for use with the IBM dot matrix
  732.       printer, is included on your CHASM distribution disk.
  733.  
  734.       Note for users of Jim Button's PC-FILE (tm):
  735.  
  736.          CHASM.CFG has the same format as PC-FILE's PRT.CTL file,
  737.          except that the /40 switch is not implemented.  If you have
  738.          already written a special PRT.CTL file, just make a copy named
  739.          CHASM.CFG for use with CHASM.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.                                                                       9
  795.  
  796.       >>Syntax<<
  797.  
  798.       CHASM accepts a standard DOS text file for input.  Lines may be
  799.       any combination of upper and lower case characters.  CHASM does
  800.       not distinguish between the two cases: everything except single
  801.       quoted strings are automatically converted to upper case during
  802.       the parsing process.  Thus, BUFFER, Buffer, buffer, and bUFFer
  803.       all refer to the same symbol.
  804.  
  805.       The characters  blank ( ), comma (,), single quote (')
  806.       semi-colon (;) and TAB are reserved, and have special meaning to
  807.       CHASM (see below).
  808.  
  809.       Each line must be no more than 80 characters long and have the
  810.       following format:
  811.  
  812.          Label Operation Operand(s) ;comment
  813.  
  814.       The different fields of an input line are separated by the
  815.       delimiters blank ( ), comma (,) or TAB.  Any number of any
  816.       delimiter may be used to separate fields.
  817.  
  818.       Explanation of Fields:
  819.  
  820.       Label: A label is a string of characters, beginning in column 1.
  821.          Depending on the operation field, the label might represent a
  822.          program location for branching, a memory location, or a
  823.          numeric constant (see the section titled "Labels" for more on
  824.          this topic). To ensure that CHASM can distinguish between
  825.          labels and numeric constants, the first character of a label
  826.          must *not* be a number (0-9), plus sign (+) or minus sign(-).
  827.          Anything beginning in column 1, except a comment, is
  828.          considered a label.
  829.  
  830.       Operation: Either a pseudo-op (see the section with the same
  831.          name) or an instruction mnemonic as defined in "The 8086
  832.          Book" by Rector and Alexy.  A list of acceptable mnemonics is
  833.          given in Appendix A.
  834.  
  835.          Note 1: Except as modified below,"The 8086 Book" is the
  836.             definitive reference for use with CHASM.
  837.  
  838.          Note 2: There are several ways to resolve some ambiguities in
  839.             8086 assembly language.  Please read page 3-285 of The 8086
  840.             Book, and "Resolution of Ambiquities" in this document.
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.                                                                      10
  861.  
  862.  
  863.       Operand(s): A list of one or more operands, as defined in
  864.          the section titled "Operands", separated by delimiters.
  865.  
  866.       Comment: Any string of characters, beginning with a semicolon
  867.          (;). Anything to the right of a semicolon will be ignored by
  868.          CHASM.
  869.  
  870.       Note that except for the case of an operation which requires
  871.       operands, or the EQU pseudo-op which requires a label, all of the
  872.       fields are optional.  The fields MUST appear in the order shown.
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.                                                                      11
  927.  
  928.       >>Labels<<
  929.  
  930.       The symbol in the label field of an input line can be interpreted
  931.       in three different ways by CHASM:
  932.  
  933.         1. A program location which may be branched to.
  934.  
  935.         2. A memory location for data storage.
  936.  
  937.         3. An equated symbol, which takes the place of a numeric
  938.            constant.
  939.  
  940.       The default interpretation of a symbol is a program location for
  941.       branching.  This default is modified by the presence of one of
  942.       the following pseudo-ops in the instruction field:
  943.  
  944.       DB, DM, DS, or DW:
  945.  
  946.             Normal:  The symbol is a memory location.
  947.  
  948.             In a Structure: The symbol is a numeric constant.
  949.  
  950.       EQU:
  951.  
  952.             Normal:  The symbol is a numeric constant.
  953.  
  954.             Memory Option:  The symbol is a memory location.
  955.  
  956.       A given symbol may have only ONE of the above interpretations!
  957.       Attempts to branch into a memory location or an equated symbol
  958.       will result in error messages.  Similarly, CHASM will not allow
  959.       you to treat program code as a data area.  Examples:
  960.  
  961.       TEXT DB  'Hit any key when ready'  ;memory location
  962.            MOV  AL,TEXT                  ;ok
  963.            JMP  TEXT                     ;wrong!
  964.       LOOP MOV  AX,CX                    ;program location
  965.            JMP  LOOP                     ;ok
  966.            MOV  AX, LOOP                 ;wrong!
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.                                                                      12
  993.  
  994.       If for some arcane reason you *need* to branch into a data area,
  995.       you can fool CHASM by placing a label on an otherwise blank line,
  996.       immediately before the data area.  Example:
  997.  
  998.             JNZ NPU
  999.             RET
  1000.       NPU                                ;dummy label for jump
  1001.             DB  D8H, 00H                 ;an 8087 instruction
  1002.  
  1003.       If you have a masocistic urge to crash your system by writing
  1004.       self-modifying code, there are at least two ways you can defeat
  1005.       CHASM's injunction against using program code as a data area.
  1006.  
  1007.       The first way is to use DS to declare zero bytes of storage
  1008.       immediately before the code you want to access.  A label on the
  1009.       null DS will have the same offset as the immediately following
  1010.       code.  Example:
  1011.  
  1012.              MOV   JUNK1, 9090         ;change endless loop to NOP
  1013.       JUNK1  DS    0
  1014.       JUNK   JMP  JUNK
  1015.  
  1016.       A sneakier approach is to load the OFFSET of a program
  1017.       location into a register, then use the register for indirect
  1018.       addressing. Using the optional displacement field, you can even
  1019.       address the middle of an instruction.  Examples:
  1020.  
  1021.              MOV   BX, OFFSET(CALL)
  1022.              MOVB  1[BX], 00H          ;change interrupt number in code
  1023.       CALL   INT   0
  1024.  
  1025.       In general, I cannot recommend trying to get around CHASM's type
  1026.       restrictions.  If you find yourself in a situation where it
  1027.       seems necessary to fool CHASM, there's probably a safer, more
  1028.       direct way to legally program what you're trying to accomplish.
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.                                                                      13
  1059.  
  1060.       To avoid ambiguity, a given string can legally appear in the
  1061.       label field of only ONE statement.  If the same string appears on
  1062.       more than one instruction, all instances after the first will
  1063.       receive an error message.
  1064.  
  1065.       TWO   EQU  '2'      ;first use is ok
  1066.       TWO   PROC FAR      ;wrong! symbol already defined
  1067.  
  1068.       CHASM has a number of reserved strings which are "predefined" in
  1069.       the symbol table, and will generate an error message if used as
  1070.       labels.  All the two letter register names are reserved, as are
  1071.       the indirect address mode combinations.  The only other reserved
  1072.       strings are the words "NEAR" and "FAR".  Examples:
  1073.  
  1074.       AX   MOV  AX, DX      ;wrong! (register name)
  1075.       [DI] ADD  AX, BX      ;wrong! (indirect address)
  1076.       FAR  CALL GETINPUT    ;wrong! (reserved word)
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.                                                                      14
  1125.  
  1126.       >>Operands<<
  1127.  
  1128.       The following operand types are allowed.
  1129.  
  1130.       1. Immediate data: A number, stored as part of the program's
  1131.          object code.  Immediate data are classified as either byte,
  1132.          expressible as an 8 bit binary integer; or word, expressible
  1133.          as a 16 bit binary integer.  If context requires it, CHASM
  1134.          will left-pad byte values with zeroes to convert them to word
  1135.          values.  Attempts to use a word value where only a byte will
  1136.          fit will cause an error message to be printed.
  1137.  
  1138.          Immediate data may be represented in 9 ways:
  1139.  
  1140.             A. An optionally signed decimal number in the range -32768
  1141.                to 32767.  Examples:
  1142.  
  1143.                MOV AL,21
  1144.                MOV BX,-6300
  1145.  
  1146.             B. A series of up to 4 hex digits, followed by the letter
  1147.                H.  The first digit must be non-alphabetic, i.e. in the
  1148.                range 0-9, to allow CHASM to distinguish between numbers
  1149.                and symbols. If necessary, a leading zero, which does
  1150.                not count in the four allowed digits, may be added to
  1151.                fulfill the non-alphabetic condition. Examples:
  1152.  
  1153.                ADD CX, 0B123H
  1154.                ADD DL, 12H
  1155.  
  1156.             C. ==>Compiled version only.
  1157.                A series of up to 16 binary digits, followed by the
  1158.                letter B.  Examples:
  1159.  
  1160.                MASK   EQU   00000111B
  1161.                       MOV   AL, 10000000B
  1162.  
  1163.  
  1164.             D. A symbol representing types A, B or C above,
  1165.                defined using the EQU pseudo-op.  Examples:
  1166.  
  1167.                MASK EQU 10H
  1168.                MAX  EQU 1000
  1169.                     AND  CL,MASK
  1170.                     SUB  AX,MAX
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.                                                                      15
  1191.  
  1192.  
  1193.             E. The offset of a label or storage location returned by
  1194.                the OFFSET operator.  OFFSET always returns a word
  1195.                value. OFFSET is used to get the address of a named
  1196.                memory location, rather than its contents.  Example:
  1197.  
  1198.                       MOV DI,OFFSET(BUFFER)
  1199.                BUFFER DS  0FFH
  1200.  
  1201.             F. The ASCII value of a printable character, represented by
  1202.                the character enclosed in single quotes (').  Thus, the
  1203.                following lines will generate the same object code:
  1204.  
  1205.                   MOV AL,41H  ;ascii code for 'A'
  1206.                   MOV AL,'A'
  1207.  
  1208.             G. ==>Compiled version only:
  1209.                Labels within structures become immediate operands whose
  1210.                values equal their offset within the structure.  See the
  1211.                section titled "Structures" for more detail and
  1212.                examples.
  1213.  
  1214.             H. ==>Compiled version only:
  1215.                The length of a structure, returned either by the LENGTH
  1216.                operator, or simply the structure's name.  See the
  1217.                section titled "Structures" for more detail and
  1218.                examples.
  1219.  
  1220.             I. ==>Compiled version only:
  1221.                The number of bytes counted by the COUNT pseudo-op,
  1222.                returned by the LENGTH operator on the COUNT's label.
  1223.                Example:
  1224.  
  1225.                HLP_MSG   COUNT
  1226.                HLP_TXT   DB 'Hit F10 for Help...' cr lf
  1227.                          ENDC
  1228.                          MOV CX, LENGTH(HLP_MSG)  ;length of message
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.                                                                      16
  1257.  
  1258.       2. Register Operands: One of the 8088's internal registers.
  1259.  
  1260.          A. An 8 bit register from the following list:
  1261.             AH    AL
  1262.             BH    BL
  1263.             CH    CL
  1264.             DH    DL
  1265.  
  1266.          B. A 16 bit register from the following list:
  1267.             AX   BX   CX   DX   SP   BP   SI   DI
  1268.  
  1269.          C. A segment register from the following list:
  1270.             CS   SS   DS   ES
  1271.  
  1272.       3. Memory Operands: The contents of a memory location addressed
  1273.          by one of the following methods.  Note that none of the memory
  1274.          addressing options specifies whether a byte or word operand
  1275.          is being referenced.  See the section titled "Resolution of
  1276.          Ambiguities" for more on this topic.
  1277.  
  1278.          A. Direct address.
  1279.  
  1280.             1. A number, or symbol representing a number, enclosed in
  1281.                brackets, indicating an offset into the data segment.
  1282.                Example:
  1283.  
  1284.                BUFFER EQU 5A5AH
  1285.                       MOV BH,[BUFFER]
  1286.                       MOV [80H],DI
  1287.  
  1288.             2. A symbol, defined to be a variable (i.e. a named memory
  1289.                location) using the EQU pseudo-op.  Example:
  1290.  
  1291.                FCB EQU [80H]
  1292.                    MOV DI,FCB
  1293.  
  1294.  
  1295.             3. A symbol, defined to be a variable by its use on a
  1296.                storage defining pseudo-op.  Examples:
  1297.  
  1298.                     MOV AX,FLAG
  1299.                     MOV DATE,BX
  1300.                FLAG DS 1
  1301.                DATE DB 31
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.                                                                      17
  1323.  
  1324.          B. Indirect Address:  The address of the operand is the
  1325.             sum of the contents of the indicated register(s) and a
  1326.             displacement.  The register, or sum of registers, are
  1327.             enclosed in square brackets: []
  1328.  
  1329.             The displacement is optional, and takes the form of an
  1330.             immediate operand, placed without intervening delimiters to
  1331.             the left of the first bracket.  Displacements in the range
  1332.             -128 to 127 (i.e. hex 0 - 7F, FF80 - FFFF) are interpreted
  1333.             as signed 8 bit quantities.  All other displacements are
  1334.             interpreted as unsigned 16 bit quantities.  (Note that
  1335.             although the 8088 supports unsigned 16 bit displacements up
  1336.             to hex FFFF for indirect addressing, CHASM isn't smart
  1337.             enough to distinguish between -1 and FFFFH.)
  1338.  
  1339.             The following indirect modes are allowed:
  1340.  
  1341.             1. Indirect through a base register (BX or BP).  Examples:
  1342.  
  1343.                ENTRYLENGTH EQU 6
  1344.                            MOV AX, ENTRYLENGTH[BP]
  1345.                            MOV DL, -2[BX]
  1346.                            MOV CX, [BP]
  1347.                            MOV 9A9AH[BX], AX
  1348.  
  1349.             2. Indirect through an index register (DI or SI).
  1350.                Examples:
  1351.  
  1352.                MOV [DI], CX
  1353.                MOV CX, -5[SI]
  1354.  
  1355.             3. Indirect through the sum of one base register and one
  1356.                index register.  Examples:
  1357.  
  1358.                MOV [BP+DI], SP      ;note that no spaces are
  1359.                MOV BX, 10H[BX+SI]   ;allowed within the
  1360.                MOV CL, [BP+SI]      ;brackets.
  1361.                MOV DH, -2[BX+DI]
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.                                                                      18
  1389.  
  1390.       4. Labels
  1391.  
  1392.          A label on most instructions may be used as an operand for
  1393.          call and jump instructions.  See the section titled "Labels"
  1394.          for more information.  Examples:
  1395.  
  1396.          START    PROC NEAR
  1397.                   CALL GETINPUT
  1398.                   JMPS START
  1399.                   ENDP
  1400.          GETINPUT PROC NEAR
  1401.  
  1402.       5. Strings
  1403.  
  1404.          A string is any sequence of characters (including delimiters)
  1405.          surrounded by single quotes (').  Example:
  1406.  
  1407.          DB 'Copyright May 15,1982'
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.                                                                      19
  1455.  
  1456.       >>Resolution of Ambiguities<<
  1457.  
  1458.       The language defined in "The 8086 Book" contains a number of
  1459.       ambiguities which must be resolved by an assembler.  This is
  1460.       discussed throughout the book, but pages 3-285 and 3-286
  1461.       specifically cover this topic.  CHASM's solutions of these
  1462.       problems are discussed in this section.
  1463.  
  1464.       A. Memory references:
  1465.  
  1466.       When one specifies the address of a memory location, it is
  1467.       unclear how large an operand is being referenced.  An operand
  1468.       might be a byte, or a word.
  1469.  
  1470.          1. If a register is present as an operand, it is assumed that
  1471.             the memory operand matches the register in size.  An
  1472.             exception to this rule are the shift and rotate
  1473.             instructions, where the CL register is used as a counter,
  1474.             and has nothing to do with the size of the other operand.
  1475.             Examples:
  1476.  
  1477.             MOV MASK,AX   ;mask is a word
  1478.             MOV DH,[BX]   ;BX points to a byte
  1479.             NEG [SI]      ;error, operand of unknown size
  1480.             SHR FLAG,CL   ;error, flag is of unknown size
  1481.  
  1482.          2. If no register is present, (or if the only register is CL
  1483.             being used as a counter) the size of the memory operand is
  1484.             specified by adding the suffix "B" or "W" to the
  1485.             instruction mnemonic.  Examples:
  1486.  
  1487.             NEGB [SI]       ;SI points to a byte
  1488.             SHRW FLAG,CL    ;flag is a word
  1489.             MOVW MASK,0AH   ;mask is a word
  1490.             MOVB MASK,0AH   ;mask is a byte
  1491.             MOVW MASK,9A9AH ;must specify size even though
  1492.                             ;immediate operand implies word
  1493.             MOVB DH,[BX]    ;error(!), register already
  1494.                             ;specifies size
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.                                                                      20
  1521.  
  1522.       B. Indirect Branching.
  1523.  
  1524.       The 8088 supports two flavors of indirect branching: intra, and
  1525.       intersegment.  A register is set to point at a memory location
  1526.       which contains a new value for the program counter, and in the
  1527.       case of intersegment branching, a new value for the CS register
  1528.       as well.
  1529.  
  1530.       The syntax of "The 8086 Book" does not specify which flavor of
  1531.       branch is being invoked.  CHASM adds the suffixes "N" (for near,
  1532.       or intrasegment) and "F" (for far, or intersegment) to the
  1533.       indirect CALL and JMP mnemonics.  Examples:
  1534.  
  1535.          CALLN [BX]    ;intrasegment call
  1536.          JMPF  [DI]    ;intersegment jump
  1537.          JMP   [BP]    ;error, unspecified flavor
  1538.  
  1539.       C. Long and Short Jumps
  1540.  
  1541.       Two types of relative jumps are supported by the 8088: short
  1542.       (specified by a signed 8 bit displacement) and long (specified by
  1543.       a 16 bit displacement).  Both are implemented in CHASM as a jump
  1544.       to a label.
  1545.  
  1546.       The short jump is specified by mnemonic JMPS, in accord with the
  1547.       IBM disassembler, but not with The 8086 Book, which uses JMP.
  1548.       Since one of the displacement bits is used to indicate direction,
  1549.       only seven are left to express the magnitude of jump.  JMPS (and
  1550.       similarly, all the jump on condition instructions) is thus
  1551.       limited to branching to labels within a range of -128 to +127
  1552.       bytes.
  1553.  
  1554.       CHASM reserves mnemonic JMP for the long jump.  JMP may be used
  1555.       to jump anywhere within the program segment, but the object code
  1556.       generated is less compact than that from JMPS.
  1557.  
  1558.       Examples:
  1559.  
  1560.          START PROC NEAR
  1561.                JMPS END     ;short jump
  1562.                JMP  START   ;long jump
  1563.          END   ENDP
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.                                                                      21
  1587.  
  1588.       D. Instruction Prefixes.
  1589.  
  1590.       The 8088 supports three instruction prefixes:
  1591.  
  1592.          1. SEG: segment override. An alternate segment register is
  1593.             specified for a reference to memory
  1594.  
  1595.          2. REP, REPE,REPNE,REPZ,REPNZ: repeat. A string primitive is
  1596.             repeated until a condition is met.
  1597.  
  1598.          3. LOCK: Turns on the LOCK signal. Only useful in
  1599.             multi-processor situations.
  1600.  
  1601.       CHASM implements these prefixes as separate instructions, rather
  1602.       than prefixes to another instruction.  They appear on a separate
  1603.       line, immediately before the instruction which they modify.
  1604.       Examples:
  1605.  
  1606.          SEG ES
  1607.          MOV AX,FLAG  ;flag is in the extra segment
  1608.          REP
  1609.          MOVSB        ;move bytes until CX decremented to 0
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.                                                                      22
  1653.  
  1654.       >>Pseudo-Operations<<
  1655.  
  1656.       The following pseudo-ops are implemented:
  1657.  
  1658.       A. BSAVE: Generate object code in BSAVE format.
  1659.  
  1660.          Instructs CHASM to build a header in the format of BASIC's
  1661.          BSAVE command.  The resulting object code file may be BLOADed
  1662.          by BASIC programs.  No operands are required, and the
  1663.          pseudo-op may appear anywhere within the source code.
  1664.          Example: 
  1665.  
  1666.                ORG    0     ;no psp
  1667.          SUBRT PROC   FAR   ;subroutine for BASIC program
  1668.                BSAVE        ;make BLOADable object file
  1669.  
  1670.       B. COUNT ...ENDC:  Count bytes.
  1671.  
  1672.          Instructs CHASM to count the number of object code bytes
  1673.          generated between COUNT and ENDC.  Both machine instructions
  1674.          and pseudo-ops can appear within the COUNT block. If a label
  1675.          appears on the COUNT, it becomes an immediate operand of value
  1676.          equal to the number of bytes counted.  Neither COUNT or ENDC
  1677.          require any operands.  COUNTs cannot be nested.
  1678.  
  1679.          It is *strongly* recommended that the immediate operands
  1680.          generated by COUNT be accessed via the LENGTH function, which
  1681.          unamgiuously forces the "immediate" type on CHASM's first
  1682.          pass.  If you do not use the LENGTH function, forward
  1683.          references to a COUNT may cause phase errors.  (See Phase
  1684.          Error in the Error Message section.)
  1685.  
  1686.          Example:
  1687.  
  1688.          MESSAGE    COUNT
  1689.          MSG_TXT    DB   'This utility requires DOS 2.0!' beep cr lf
  1690.                     ENDC
  1691.  
  1692.                     MOV SI, OFFSET(MSG_TXT)
  1693.                     MOV DI, OFFSET(BUFFER)
  1694.                     MOV CX, LENGTH(MESSAGE)
  1695.                     REP
  1696.                     MOVSB                   ;move message into buffer
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.                                                                      23
  1719.  
  1720.       C. DB: Declare Bytes
  1721.  
  1722.          Memory locations are filled with values from the operand list.
  1723.          Any number of operands may appear, but all must fit on one
  1724.          line. Acceptable operands are immediate data, or strings
  1725.          enclosed in single quotes (').  DB interprets strings as a
  1726.          series of ASCII bytes.
  1727.  
  1728.          If a label appears, it is redefined as a memory location, and
  1729.          the data area may be referred to using the label, rather than
  1730.          an address. Examples:
  1731.  
  1732.                MOV AX,MASK
  1733.          MASK  DB  00H,01H
  1734.          STG   DB  'A string operand'
  1735.  
  1736.          DB will attempt to interpret operands as byte values whenever
  1737.          possible.  For example, the operand 0012H results in only
  1738.          *one* byte of object code being generated.  However, since
  1739.          OFFSET operands are always considered 16 bit quantities, two
  1740.          bytes will be generated regardless of the OFFSET's magnitude.
  1741.  
  1742.          ==> Compiled version only.
  1743.  
  1744.          The compiled version of CHASM generates an error message
  1745.          ("Data too large") if word operands (such as OFFSETs, or
  1746.          numbers greater than 255) are found in the DB operand list.
  1747.          DW should be used for declaring words in CHASM's compiled
  1748.          version.
  1749.  
  1750.       D. DM: Declare Multiple Bytes
  1751.  
  1752.          ==>Compiled version only.
  1753.  
  1754.          Used to declare blocks of storage, the number of bytes
  1755.          declared being the product of two immediate operands.  If only
  1756.          one operand is present, the other operand is assumed to equal
  1757.          one.
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.                                                                      24
  1785.  
  1786.          As with DB, any label is redefined as a memory location.  To
  1787.          save space, the object code does not appear on the listing.
  1788.          It is anticipated that this pseudo-op will be used in
  1789.          conjunction with STRUC, to declare structured storage.
  1790.          Example:
  1791.  
  1792.             DM  LENGTH(MAILIST) 500   ;mailing list with 500 entries
  1793.  
  1794.       E. DS: Declare Storage
  1795.  
  1796.          Used to declare large blocks of identically initialized
  1797.          storage.  The first operand is required, a number specifying
  1798.          how many bytes are declared.  If a second operand in the form
  1799.          of a number 0-FFH appears, the locations will all be
  1800.          initialized to this value.  If the second operand is not
  1801.          present, locations are initialized to 0.   As with DB, any
  1802.          label is redefined as a memory location.  To save space, the
  1803.          object code does not appear on the listing.  Examples:
  1804.  
  1805.             DS 10         ;10 locs initialized to 0
  1806.             DS 100H,1AH   ;256 locs initialized to 1AH
  1807.  
  1808.       F. DW: Declare Words
  1809.  
  1810.          ==>Compiled version only.
  1811.  
  1812.          Used to unambiguously assign a word of storage for each item
  1813.          in the operand list.  Any number of immediate operands may
  1814.          appear, but all must fit on one line.  As with DB, any label
  1815.          is redefined as a memory location. Example:
  1816.  
  1817.              DW 0012H, FFFFH       ;four bytes declared
  1818.  
  1819.       G. EJECT: Begin New Print Page
  1820.  
  1821.          Causes CHASM to move to the top of the next page in printed
  1822.          listings.  Has no effect on listings sent to the screen or to
  1823.          disk.
  1824.  
  1825.       H. ENDC: End of Count
  1826.  
  1827.          ==> Compiled version only.
  1828.  
  1829.          See COUNT (above) for details.
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.                                                                      25
  1851.  
  1852.       I. ENDP: End of Procedure
  1853.  
  1854.          See PROC (below) for details.
  1855.  
  1856.       J. ENDSTRUC: End of Structure
  1857.  
  1858.          ==>Compiled version only.  See STRUC (below) for details.
  1859.  
  1860.       K. EQU: Equate
  1861.  
  1862.          Used to equate a symbolic name with a number. The symbol may
  1863.          then be used anywhere the number would be used.  Use of
  1864.          symbols makes programs more understandable, and simplifies
  1865.          modification.
  1866.  
  1867.          An alternate form of EQU encloses the number in square
  1868.          brackets: []. The symbol is then interpreted as a memory
  1869.          location, and may be used as an address for memory access.
  1870.          This version is provided to allow symbolic reference to
  1871.          locations outside the program segment. Examples:
  1872.  
  1873.             MOFFSET    EQU 0B000H
  1874.             MONOCHROME EQU [0000H]
  1875.  
  1876.          Warning: Difficult to debug errors may result from using a
  1877.          symbol prior to its being defined by EQU.  I strongly urge
  1878.          that all equates be grouped together at the beginning of
  1879.          programs, before any other instructions. See "Phase Error" in
  1880.          the Error Message section.
  1881.  
  1882.       L. INCLUDE: Include file
  1883.  
  1884.          ==>Compiled version only.
  1885.  
  1886.          INCLUDE requires one operand, a filename with optional drive
  1887.          specifier and extension.  The contents of the specified file
  1888.          are logically inserted into the source file at the point
  1889.          where the INCLUDE appears.  INCLUDEs cannot be nested: an
  1890.          error message will be printed if the specified file itself
  1891.          contains an INCLUDE.
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.                                                                      26
  1917.  
  1918.       M. LIST: Enable listing output
  1919.  
  1920.          ==> Compiled version only.
  1921.  
  1922.          Output to the list device is enabled, presumably after a
  1923.          NOLIST was encountered.  No operands required.
  1924.  
  1925.       N. NOLIST: Disable listing output
  1926.  
  1927.          ==> Compiled version only.
  1928.  
  1929.          Normal output to the list device is disabled.  Error messages
  1930.          are listed as usual.  No operands required.
  1931.  
  1932.       O. ORG: Origin
  1933.  
  1934.          Allows direct manipulation of the location counter during
  1935.          assembly.  By default, CHASM assembles code to start at offset
  1936.          100H, thus leaving room for the program segment prefix
  1937.          normally built by COMMAND or DEBUG.  In situations where no
  1938.          PSP is provided, such as routines to be called from BASIC, you
  1939.          should override this default with ORG, or incorrect assembly
  1940.          may result.
  1941.  
  1942.          ORG requires one operand, a number between 0 and 32767, which
  1943.          represents the new setting of CHASM's location counter.
  1944.          Although the location counter may be reset anywhere within a
  1945.          program, generally this pseudo-op should be used before any
  1946.          machine executable instructions for meaningful results.
  1947.  
  1948.          Example:
  1949.  
  1950.            ORG 0   ;Code will be assembled for starting
  1951.                    ;offset of 0
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.                                                                      27
  1983.  
  1984.       P. PROC ...ENDP: Procedure Definition
  1985.  
  1986.          Declares a procedure.  One operand is required on PROC, either
  1987.          the word NEAR, or the word FAR.  This pseudo-op warns CHASM
  1988.          whether to assemble returns as intra (near) or intersegment
  1989.          (far).  Procedures called from within your program should be
  1990.          declared NEAR.  All others should be FAR.  ENDP terminates the
  1991.          procedure, and requires no operands.  If a RET is encountered
  1992.          outside of a declared procedure, an error occurs.  Procedures
  1993.          may be nested, up to 10 deep.  Example:
  1994.  
  1995.          MAIN  PROC  FAR
  1996.                ...
  1997.                ...      ;body of procedure
  1998.                ENDP
  1999.  
  2000.  
  2001.       Q. STRUC ...ENDSTRUC: Structure Definition
  2002.  
  2003.          ==> Compiled version only.
  2004.          Declares a structure.  STRUC requires no operands, and signals
  2005.          CHASM that the following lines constitute a structure
  2006.          template, and not actual storage declaration.  If a label
  2007.          appears on the STRUC, the label is equated with the length of
  2008.          the structure.
  2009.  
  2010.          ENDSTRUC terminates the structure definition, and requires no
  2011.          operands.
  2012.  
  2013.          Inside the structure, storage defining pseudo-ops behave
  2014.          somewhat differently.  See the section titled "Structures" for
  2015.          more information. Example:
  2016.  
  2017.              DIRENTRY STRUC      ;disk directory entry
  2018.              NAME     DS    8
  2019.              EXT      DS    3
  2020.              ATRIB    DS    1
  2021.              RESERVED DS   10
  2022.              TIME     DS    2
  2023.              DATE     DS    2
  2024.              START    DS    2
  2025.              SIZE     DS    4
  2026.                       ENDSTRUC
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.                                                                      28
  2049.  
  2050.       >>Structures<<
  2051.  
  2052.       ==>Compiled version only.
  2053.  
  2054.       Structures are an advanced feature.  Beginners may wish to skip
  2055.       this section until they become more experienced with CHASM and
  2056.       assembly language programming.
  2057.  
  2058.       CHASM's structure capability allows you to generate a "template"
  2059.       with which to organize repetitive data structures.  As an example
  2060.       of a repetitive data structure, consider a phone list.  Each
  2061.       entry in the list has three components:
  2062.  
  2063.            Name    - 20 characters
  2064.            Address - 50 characters
  2065.            Phone   - 10 characters
  2066.  
  2067.       Each entry thus uses a total of 80 bytes of storage.  To declare
  2068.       a list with 500 entries, you would declare 80 x 500 = 4000 bytes:
  2069.  
  2070.            PHONELIST  DS  4000   ;500 entries @ 80 bytes/entry
  2071.  
  2072.       That's easy enough, but now what's the offset of the 346th
  2073.       address field?  This is starting to get confusing, and time
  2074.       consuming to figure out.
  2075.  
  2076.       Furthermore, hard-coding numbers (like that 4000, above) into a
  2077.       program is never a good idea.  What's going to happen when you
  2078.       decide to add a zip code field, or make more room in the name
  2079.       field because you just met Alexandria Zbrievskivich?  You'd have
  2080.       to go through and change by hand each number which depended on
  2081.       the actual layout of your data.  Murphy's law guarantees that
  2082.       it'll take somewhere between "several" and "too many" assemblies
  2083.       to find them all.
  2084.  
  2085.       Structures allow you to set up a symbolic template which makes it
  2086.       much easier to manage structured data like this phone list.  By
  2087.       using symbols defined in the structure, rather than bare numbers,
  2088.       a change in data structure doesn't mean a frantic search
  2089.       throughout your entire program to make corrections.  If you
  2090.       change the structure definition, the symbols take on new values
  2091.       automatically.
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.                                                                      29
  2115.  
  2116.       Here's what the phone list structure looks like:
  2117.  
  2118.            LISTENTRY  STRUC
  2119.            NAME       DS 20
  2120.            ADDRESS    DS 50
  2121.            PHONE      DS 10
  2122.                       ENDSTRUC
  2123.  
  2124.       Note the STRUC and ENDSTRUC statements.  They mark the beginning
  2125.       and end of the structure, and give it a name (LISTENTRY).
  2126.  
  2127.       Within the structure are storage defining pseudo-ops.  DS is used
  2128.       in this example, but DB, DW, and DM could also be used.  ORG can
  2129.       be used within a structure, but any 8088 instruction will result
  2130.       in an diagnostic message and termination of the structure
  2131.       definition.
  2132.  
  2133.       Inside a structure, the storage defining pseudo-ops
  2134.       behave somewhat differently than normal.  No actual storage is
  2135.       set aside, but CHASM keeps track of how much space would normally
  2136.       be declared.
  2137.  
  2138.       Labels on pseudo-ops get assigned values equal to their offset
  2139.       within the *structure*, not within the program as a whole.  Also,
  2140.       CHASM will treat the labels as immediate operands, rather than
  2141.       memory locations.  The result of the structure given above is to
  2142.       generate three immediate operands, with the following values:
  2143.  
  2144.            NAME    =  0
  2145.            ADDRESS = 20
  2146.            PHONE   = 70
  2147.  
  2148.       CHASM does one other piece of useful book-keeping during
  2149.       structure definitions.  If a label appears on the STRUC
  2150.       pseudo-op, it gets treated as an immediate operand, whose value
  2151.       is equal to the total length of the structure.
  2152.  
  2153.       You can either use the STRUC label directly as an operand, or if
  2154.       you like "pretty" code, use the LENGTH operator on it.  In this
  2155.       example, both LISTENTRY and LENGTH(LISTENTRY) are immediate
  2156.       operands of value 80.
  2157.  
  2158.       (Inside note: LENGTH is a null operator, provided mainly for
  2159.       aesthetic reasons.  Using LENGTH will often make your code more
  2160.       readable, but is equivalent to using just the label itself.)
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.                                                                      30
  2181.  
  2182.  
  2183.       Like equates, structures should be placed at the beginning of
  2184.       your programs, before any machine instructions, otherwise phase
  2185.       errors can occur.  If you *do* embed structures inside your
  2186.       program, you can eliminate any phase errors by using the LENGTH
  2187.       function to reference any of the immmediate operands generated by
  2188.       the embedded structure.
  2189.  
  2190.       The immediate operands generated during a structure definition
  2191.       can be very useful in writing your program.  Following the phone
  2192.       list example, here's a better way to declare storage for the
  2193.       list, using the Declare Multiple pseudo-op:
  2194.  
  2195.          PHONELIST  DM  LISTENTRY, 500   ;500 entries of length
  2196.                                          ;defined by the structure.
  2197.  
  2198.       Now if you add another field to the structure, PHONELIST will
  2199.       automatically increase in size.
  2200.  
  2201.       The 8088's indirect addressing modes, coupled with structures,
  2202.       make a very powerful combination for accessing structured data in
  2203.       memory.  Suppose AX contains the number of the entry you want to
  2204.       work on.  You can calculate the address of the entry as follows:
  2205.  
  2206.           MOV BX, LENGTH(LISTENTRY)    ;length per entry
  2207.           MUL AX,BX                    ;times entry number
  2208.           ADD AX, OFFSET(PHONELIST)    ;plus the starting offset
  2209.           MOV BX,AX                    ;BX <== frame pointer
  2210.  
  2211.       BX is now a "frame pointer" - it points to the beginning of the
  2212.       desired entry.  You can access the various parts of the entry
  2213.       using the optional displacement field in the indirect address.
  2214.       For example, here's how you would store the letter 'A' into the
  2215.       first byte of the address field:
  2216.  
  2217.            MOV  ADDRESS[BX], 'A'
  2218.  
  2219.       As another example, the following line reads the first letter of
  2220.       the name into the AL register:
  2221.  
  2222.            MOV  AL, NAME[BX]
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.                                                                      31
  2247.  
  2248.       The more complicated indirect modes can be used to scan through
  2249.       or point within the fields.  The following program fragment gets
  2250.       the fourth digit in the phone number:
  2251.  
  2252.            MOV DI, 4             ;specify 4th digit
  2253.            MOV AL, PHONE[BX+DI]  ;read it into AL
  2254.  
  2255.       Often times, you'll want to process entries sequentially.  To
  2256.       move to the next entry, you just add the length of the entry to
  2257.       the frame pointer:
  2258.  
  2259.            ADD   BX, LENGTH(LISTENTRY)    ;point to next entry
  2260.  
  2261.       The preceding examples should give you a feel for what you can
  2262.       do with structures, but do not exhaust all the possibilities.
  2263.       Experiment with this feature, and many of your programs will be
  2264.       both more readable and more easily modified.
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.                                                                      32
  2313.  
  2314.       >>Outside the Program Segment<<
  2315.  
  2316.       As mentioned previously, CHASM does not support multiple segment
  2317.       definitions.  Provision is made for limited access outside of the
  2318.       program segment, however.
  2319.  
  2320.       A. Memory References:
  2321.          To access memory outside the program segment, you move a new
  2322.          segment address into the DS register, then address using
  2323.          offsets in the new segment.  The memory option of the EQU
  2324.          pseudo-op allows you to give a variable name to offsets in
  2325.          other segments. For example, to access DOS's equipment flag:
  2326.  
  2327.             BIOS_DATA   EQU  40H
  2328.             EQUIP_FLAG  EQU  [0010H]
  2329.                         MOV  AX,BIOS_DATA  ;can't move immed. to DS
  2330.                         MOV  DS,AX
  2331.                         MOV  AX,EQUIP_FLAG ;get bios equipment flag
  2332.  
  2333.       B. Code Branching:
  2334.          CHASM supports 4 instructions for branching outside the
  2335.          program segment.
  2336.  
  2337.          1. Direct CALL and JMP
  2338.  
  2339.             New values for the PC and CS registers are included in the
  2340.             instruction as two immediate operands.  Example:
  2341.  
  2342.             BIOS         EQU  0F000H            ;RAM bios segment
  2343.             DISKETTE_IO  EQU  0EC59H            ;disk handler
  2344.                          JMP  DISKETTE_IO,BIOS
  2345.  
  2346.          2. Indirect CALLF and JMPF
  2347.  
  2348.             Four consecutive bytes in memory are initialized with new
  2349.             values for the PC and CS registers.  The CALLF or JMPF then
  2350.             references the address of the new values.  Example:
  2351.  
  2352.             BIOS        EQU   0F000H           ;RAM bios segment
  2353.             PRINTER_IO  EQU   0EFD2H           ;printer routine
  2354.                         MOV   [DI],PRINTER_IO
  2355.                         MOV   2[DI],BIOS
  2356.                         CALLF [DI]
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.                                                                      33
  2379.  
  2380.       >>Running CHASM<<
  2381.  
  2382.       A. Prompt Mode
  2383.  
  2384.          From DOS, type:
  2385.  
  2386.            CHASM
  2387.  
  2388.          After a few seconds, CHASM prints a hello screen, then
  2389.          prompts:
  2390.  
  2391.            Hit any key to continue...
  2392.  
  2393.          CHASM will then prompt:
  2394.  
  2395.             Source code file name? [.asm]
  2396.  
  2397.          Type in the name of the file which contains your program.  If
  2398.          you do not include an extension for the filename, CHASM
  2399.          assumes it to be .ASM.  If CHASM is unable to find the file,
  2400.          it will give you the option of naming another file, or
  2401.          returning to DOS.
  2402.  
  2403.          Assuming your file is present, CHASM prompts:
  2404.  
  2405.             Direct listing to Printer (P), Screen (S), or Disk (D)?
  2406.             [nul:]
  2407.  
  2408.          Respond with either an upper or lower case letter.  If you
  2409.          just press enter, no listing will be produced.  If you select
  2410.          "D", CHASM will prompt:
  2411.  
  2412.             Name for listing file? [fname.lst]
  2413.  
  2414.          Type in a name for the listing file.  If you just press ENTER,
  2415.          the name defaults to that of your source file, with an
  2416.          extension of .LST.  Notes:
  2417.  
  2418.             1. Error messages are always echoed to the screen.
  2419.  
  2420.             2. Suppressing the listing will result in slightly faster
  2421.                assembly.
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.                                                                      34
  2445.  
  2446.          The final prompt is:
  2447.  
  2448.             Name for object file? [fname.com]
  2449.  
  2450.          Type in a name for the assembled program.  If you just press
  2451.          ENTER, the name defaults to that of your source file, with an
  2452.          extension of .COM.
  2453.  
  2454.          CHASM now assembles your program.  A status line is maintained
  2455.          on the screen, showing how many lines have been processed.
  2456.          CHASM makes two passes over your source file, outputting the
  2457.          listing and object code on the second pass.  You may abort
  2458.          assembly and return to DOS at any time by pressing the Esc
  2459.          key.
  2460.  
  2461.          Please be patient during assembly, CHASM is written in BASIC,
  2462.          and the interpreted version does a good imitation of a snail
  2463.          crawling through molasses.  An order form for a much faster
  2464.          compiled version is included at the end of this document.
  2465.  
  2466.          NOTE: I will send the Golden Bootstrap Award to the first
  2467.             person submitting a complete implementation of CHASM,
  2468.             rewritten in CHASM assembly language.
  2469.  
  2470.        When finished, CHASM returns you to DOS, and you see the prompt:
  2471.  
  2472.             A>
  2473.  
  2474.       B. Expert Mode:
  2475.  
  2476.          ==>Compiled version only.  This mode allows you to specify all
  2477.          i/o information on the command line which invokes CHASM.  The
  2478.          syntax is:
  2479.  
  2480.             CHASM sourcefile [p|s|d|/] [listfile|/] [objectfile]
  2481.  
  2482.          Items within brackets ([]) are optional. You may select *one*
  2483.          of any list of items separated by a bar (|).
  2484.  
  2485.          Basically, you just include on the command line all your
  2486.          responses to the normal prompts.  Each response must be
  2487.          separated from the others by either a space or comma.
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.                                                                      35
  2511.  
  2512.          If you don't specify the list device/file or the object file,
  2513.          they default to NUL: and sourcename.COM respectively.  To
  2514.          represent a carriage return (to specify a default choice, but
  2515.          allow modifying a later response) use the character slash
  2516.          (/).
  2517.  
  2518.          Expert mode examples:
  2519.  
  2520.             1. Source file is CLEAR.ASM, no listing, object file
  2521.                CLEAR.COM:
  2522.  
  2523.                   CHASM clear
  2524.  
  2525.             2. Source file is SDIR.ASM, list to printer, object file
  2526.                SDIR.COM:
  2527.  
  2528.                   CHASM sdir p
  2529.  
  2530.             3. Source file is MYFILE.PRG, list to disk file MYFILE.LST,
  2531.                object file SUBR.COM:
  2532.  
  2533.                   CHASM myfile.prg d / subr.com
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.                                                                      36
  2577.  
  2578.       >>Error and Diagnostic Messages<<
  2579.  
  2580.       Error messages generated on pass one appear on the listing before
  2581.       any source code is printed, and mention the line number to which
  2582.       they refer.  The majority of messages occur during pass two, and
  2583.       will appear in the listing immediately prior to the line which
  2584.       caused the message.  Unless the listing itself is going to the
  2585.       screen, messages and the source line which generated them will be
  2586.       echoed there.
  2587.  
  2588.       Add Leading Zero to Hex Constant: Diagnostic.  The Undefined
  2589.          Symbol could be interpreted as a hexadecimal number if a
  2590.          leading zero was added.
  2591.  
  2592.       Could Use JMPS: Diagnostic.  The specified label requires an
  2593.          offset of less than 128 bytes; specifying the short jump would
  2594.          result in more compact code.  The assembled code is correct,
  2595.          however.
  2596.  
  2597.       Data too Large: XXX   XXX was found in DB operand list, but is a
  2598.          word value.  Use DW to declare words.
  2599.  
  2600.       DM out of range:  The product of the DM's operands is either
  2601.          negative, or greater than 32767.
  2602.  
  2603.       Duplicate Definition of XXX in (linenum): Pass 1 error.  An
  2604.          attempt was made to define a symbol already present in the
  2605.          symbol table.
  2606.  
  2607.       ENDC without COUNT: An ENDC was encountered, but no corresponding
  2608.          COUNT was found.
  2609.  
  2610.       ENDP without PROC: An ENDP was encountered, but no corresponding
  2611.          PROC was found.
  2612.  
  2613.       ENDSTRUC without STRUC: An ENDSTRUC was encountered, but no
  2614.          corresponding STRUC was found.
  2615.  
  2616.       EQU Without Label: No symbol was found to equate with the
  2617.          operand.
  2618.  
  2619.       File not found: XXX in (linenum).  Pass one error.  CHASM was
  2620.          unable to find the file XXX, specified in the INCLUDE
  2621.          pseudo-op.
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.                                                                      37
  2643.  
  2644.       Illegal Label: XXX in (linenum). Pass one error.  The symbol XXX
  2645.          begins in column one and has as its first character a number,
  2646.          or a plus or minus sign.
  2647.  
  2648.       Illegal Operation for Structure - ENDSTRUC Implied: Diagnostic.
  2649.          The current line is within a structure, and is not a storage
  2650.          defining pseudo-op.  CHASM generates an ENDSTRUC, which
  2651.          terminates the structure definition, then assembles the line
  2652.          normally.
  2653.  
  2654.       Illegal or Undefined Argument for LENGTH:  The argument for the
  2655.          LENGTH  function was not present in the symbol table as an
  2656.          immediate operand on pass 2.
  2657.  
  2658.       Illegal or Undefined Argument for OFFSET: The argument for the
  2659.          OFFSET function was not present in the symbol table as a near
  2660.          label or memory location on pass 2.
  2661.  
  2662.       Missing ENDC: The end of the input file was encountered, and at
  2663.          least one COUNT had not been terminated by an ENDC.
  2664.  
  2665.       Missing ENDP: The end of the input file was encountered, and at
  2666.          least one PROC had not been terminated by an ENDP.
  2667.  
  2668.       Missing ENDSTRUC: The end of the input file was encountered, and
  2669.          at least one STRUC had not been terminated by an ENDSTRUC.
  2670.  
  2671.       Nested COUNT:  A COUNT was encountered while CHASM was already
  2672.          COUNTing.  COUNTs cannot be nested.
  2673.  
  2674.       Nested INCLUDE: An INCLUDE was encountered in an INCLUDEd file.
  2675.          The INCLUDE pseudo-op cannot be nested.
  2676.  
  2677.       Nested Structure: A STRUC was encountered inside a structure.
  2678.          Structures cannot be nested.
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.                                                                      38
  2709.  
  2710.       Phase Error: A label or memory location is found to have
  2711.          different values on pass 1 and pass 2.  A difficult to debug
  2712.          error: generally the problem is not caused by the statement
  2713.          which received the error message.
  2714.  
  2715.          There are three documented ways to generate this error.
  2716.  
  2717.          1. A previous instruction used a symbolic immediate operand
  2718.             prior to the symbol's definition.
  2719.  
  2720.          2. A previous instruction made improper use of a forward
  2721.             referenced label, either an attempt to branch into a data
  2722.             area, or to access a code area as if it was data.
  2723.  
  2724.          3. The label on the flagged statement is defined more than
  2725.             once in the program.
  2726.  
  2727.          I would appreciate hearing about any other situations which
  2728.          cause this message to appear.
  2729.  
  2730.       Procedures Nested Too Deeply: Procedures may be nested no more
  2731.          than 10 deep.
  2732.  
  2733.       Source Line Truncated:  The length of the input line exceeded 80
  2734.          characters.
  2735.  
  2736.       Specify Word or Byte Operation: Diagnostic.  CHASM suggests that
  2737.          the Syntax Error might be resolved by adding the suffix "B" or
  2738.          "W" to the instruction mnemonic.  Most, but not all, ambiguous
  2739.          memory references are flagged with this diagnostic.
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.                                                                      39
  2775.  
  2776.       Syntax Error: (OP) (DTYPE) (STYPE).  CHASM was unable to find a
  2777.          version of the instruction (OP) which allows the operand types
  2778.          (DTYPE) and (STYPE).  Either the instruction doesn't exist, or
  2779.          it is an inappropriate choice for the given operands.  DTYPE
  2780.          and STYPE are numbers which encode CHASM's guess as to what
  2781.          the 1st and 2nd operands might be. The numbers are sums of the
  2782.          types given in the following list:
  2783.  
  2784.              1 = 8 bit accumulator            2 = 16 bit accumulator
  2785.              4 = 8 bit register               8 = 16 bit register
  2786.             16 = indirect memory reference   32 = CS register
  2787.             64 = other segment register     128 = memory location
  2788.            256 = immediate byte             512 = immediate word
  2789.           1024 = none                      2048 = string
  2790.           4096 = near label                8192 = reserved
  2791.          16384 = CL (count) register
  2792.  
  2793.       Too Far For Short Jump: The displacement to the specified label
  2794.          is not in the range -128 to +127.
  2795.  
  2796.       Too Many User Symbols in (linenum): Pass one error.  The symbol
  2797.          table is full.
  2798.  
  2799.       Undefined Operand for EQU: Any operands on an EQU statement must
  2800.          have been previously defined.
  2801.  
  2802.       Undefined Symbol XXX: The symbol XXX was used as an operand, but
  2803.          never appeared as a label, and is not a predefined symbol.
  2804.  
  2805.       Unrecognized Operand XXX: XXX is used in the DB or DW operand
  2806.          list, but is not a valid immediate operand. (or string, in the
  2807.          case of DB).
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.                                                                      40
  2841.  
  2842.       >>Execution of Assembled Programs<<
  2843.  
  2844.       A. Object code format
  2845.  
  2846.          The object code file produced by CHASM is in the form of a
  2847.          memory image, exactly as will be present in your computer at
  2848.          run time.  No link step is required.  Provided that the segment
  2849.          registers are set correctly, the architecture of the 8088
  2850.          guarantees that code is self-relocating, and will run correctly
  2851.          loaded anywhere in memory.  Storing a program as an exact image
  2852.          of memory at run time is called the COM format by IBM.
  2853.  
  2854.          This COM format is *not* that produced by the IBM assembler.
  2855.          The output of the IBM assembler is in the form of an "object
  2856.          module" suitable for input to the linker.  To the best of my
  2857.          knowledge, the object module is not directly executable, but
  2858.          must first be "filtered" through the linker.  This adds an
  2859.          extra step to the process of producing a working program, but
  2860.          gives you the option of combining multiple object modules into
  2861.          one program.  The resulting linked program is *still* not a
  2862.          memory image, but has a header which is used to perform
  2863.          relocation during loading.  This linked program plus header is
  2864.          called the EXE format by IBM.
  2865.  
  2866.       B. Running Assembled Programs From DOS
  2867.  
  2868.          DOS provides a loader for running machine language programs.
  2869.          To run a program, you merely type its name, without the
  2870.          extension.  This is what you're doing every time you use a DOS
  2871.          external command such as FORMAT or CHKDSK.  In fact, the COM
  2872.          format is named after "external COMmand".
  2873.  
  2874.          When DOS loads a program, it examines the file extension to
  2875.          determine what format the file is in, either COM or EXE.  This
  2876.          is why CHASM defaults to using the extension .com for your
  2877.          object file.  If you plan to run the program from DOS, don't
  2878.          change the extension.
  2879.  
  2880.          For COM programs, DOS builds a 255 byte long "program segment
  2881.          prefix" and sets the segment registers to point to this PSP.
  2882.          The contents of the file are then loaded verbatim right after
  2883.          the PSP, at offset hex 100 in the segment defined by the
  2884.          segment registers.  As soon as loading is complete, your
  2885.          program is executed starting with the instruction at hex 100.
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.                                                                      41
  2907.  
  2908.          Although you can totally ignore the PSP, you should read pages
  2909.          E-3 through E-11 of the DOS manual to see what DOS puts there
  2910.          for you.  It turns out there are some real goodies which your
  2911.          program might want to use.
  2912.  
  2913.          When your program is done, it must transfer control back to
  2914.          DOS, otherwise the 8088 will continue to fetch what it
  2915.          believes are instructions from whatever garbage or bit-hash
  2916.          happens to follow your program in memory.  The easiest way to
  2917.          return to DOS is to execute the instruction:
  2918.  
  2919.            INT 20H
  2920.  
  2921.          This is the vectored interrupt reserved by DOS for program
  2922.          termination.
  2923.  
  2924.          While we're on the topic of vectored interrupts, you would be
  2925.          well rewarded to study both the DOS manual and Technical
  2926.          Reference to find out what happens when you execute some of
  2927.          the other interrupts.  Some very useful functions, such as
  2928.          file handling and screen i/o, are available at the machine
  2929.          language level through this mechanism.
  2930.  
  2931.          Looking at things the other way, by changing the interrupt
  2932.          vector for a given function to point to your own code, you can
  2933.          override the way DOS or the BIOS does something, and do it
  2934.          your way.  DOS even provides a method (via interrupt 27H) by
  2935.          which your new code can be grafted onto DOS, and not be
  2936.          overwritten by other programs.
  2937.  
  2938.       C. Debugging Assembled Programs
  2939.  
  2940.          IBM provides an excellent utility with DOS, called DEBUG.COM.
  2941.          By specifying your program's name as a parameter when invoking
  2942.          DEBUG, you can observe your program execute with DEBUG's trace
  2943.          and other functions.  To debug your program, from DOS type:
  2944.  
  2945.             DEBUG progname.COM
  2946.  
  2947.          DEBUG builds a PSP and loads your program just like DOS does,
  2948.          but you have the added power of the debugging commands to
  2949.          monitor your program while it runs.  See chapter 6 of the DOS
  2950.          manual for more details about using DEBUG.
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.                                                                      42
  2973.  
  2974.          On the topic of debugging, I can recommend most highly a
  2975.          program called TRACE86, from Morgan Computing (10400 N.
  2976.          Central Expressway, Suite 210, Dallas, TX 75231).  The program
  2977.          replaces DEBUG, and although a little steeply priced at $125,
  2978.          makes the IBM debugger look silly.  I've been using TRACE86
  2979.          for some time now, and wouldn't be without it.
  2980.  
  2981.       D. Using Assembled Programs in BASIC
  2982.  
  2983.          To incorporate a machine language subroutine in a BASIC
  2984.          program, write it in assembly language, then assemble it with
  2985.          CHASM.  You should read page C-7 of the BASIC manual for some
  2986.          conventions to use in writing your subroutine.  In particular,
  2987.          note that you must declare the routine to CHASM as a FAR
  2988.          procedure using the PROC pseudo-op, and that the last
  2989.          instruction of the routine should be a RET.
  2990.  
  2991.          Unlike programs which are run directly from DOS, your routine
  2992.          will not be preceded by a program segment prefix.  You should
  2993.          prevent CHASM from leaving room for a PSP by putting an ORG 0
  2994.          pseudo-op at the beginning of your routine. If you don't
  2995.          include the ORG, memory references will not be assembled
  2996.          correctly.  Example:
  2997.  
  2998.               ORG  0    ;no psp
  2999.          SUBR PROC FAR  ;far procedure
  3000.               ...       ;body of subroutine
  3001.               RET
  3002.               ENDP
  3003.  
  3004.          CHASM supports two methods for getting assembled routines into
  3005.          BASIC programs.  The methods differ in whether the routine is
  3006.          included in the BASIC program file, or in a separate file.
  3007.  
  3008.          To include the code within a BASIC program file, run it
  3009.          through the utility COM2DATA, supplied on your CHASM disk.
  3010.          COM2DATA reads in a .COM format file, and produces a file of
  3011.          equivalent DATA statements which can be merged into a BASIC
  3012.          program. Your program can then READ the data and POKE it into
  3013.          memory.  An example program to do this is given on page C-6 of
  3014.          the BASIC manual.  An alternative approach would be to store
  3015.          the routine in a string variable, which could later be located
  3016.          with the VARPTR function. 
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.                                                                      43
  3039.  
  3040.          If you would prefer to keep your machine language subroutine
  3041.          in a separate file, include a BSAVE pseudo-op somewhere within
  3042.          your assembly language source code.  CHASM will build a header
  3043.          on the object code produced, which will mimic that built by
  3044.          BASIC's BSAVE command.  The resulting file may be BLOADed by
  3045.          BASIC anywhere in memory.
  3046.  
  3047.          You transfer control to your routine with either the USR
  3048.          function, or the CALL statement.  Syntax for these statements
  3049.          can be found in the BASIC manual.
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.                                                                      44
  3105.  
  3106.       >>Notes for Those Upgrading to This Version of CHASM<<
  3107.  
  3108.       CHASM is not yet carved in stone - improvements and corrections
  3109.       are made fairly frequently, based on both my own experience in
  3110.       using the program, and the comments of outside users.  This
  3111.       section summarizes the changes which have been made since version
  3112.       1.2 was released.  Changes followed with an asterisk (*) denote
  3113.       modifications which could invalidate programs written under
  3114.       earlier versions of CHASM.
  3115.  
  3116.       Version     Notes
  3117.  
  3118.       3.14        Interpreted version frozen at version 2.13, further
  3119.                   changes apply only to compiled version.  Memory
  3120.                   requirement raised to 128K.  INCLUDE, STRUC,
  3121.                   ENDSTRUC, DM, DW, LIST, NOLIST, COUNT and ENDC
  3122.                   pseudo-ops added.  Alternate mnemonics for the jump
  3123.                   on condition instructions, and alternate syntax for
  3124.                   the DIV and MUL instructions.  Binary numbers added.
  3125.                   Intersegment CALL and JMP fixed.
  3126.  
  3127.       2.13        Assembly can now be aborted with the Esc key.
  3128.                   Negative decimal numbers are working again.  Input
  3129.                   lines now limited to 80 characters, and labels must
  3130.                   begin with a non-numeral. (*) 
  3131.  
  3132.       2.12        Listings can now be suppressed.  Error messages are
  3133.                   echoed to the console on non-screen listings.
  3134.                   Expert mode added.
  3135.  
  3136.       2.11        Pagination improved.  Listings now time stamped.
  3137.                   OFFSETs and word values now allowed in DB operand
  3138.                   list.
  3139.  
  3140.       2.10        Equated symbols allowed in the DB operand
  3141.                   list.  Status line improved.
  3142.  
  3143.       2.09        The first digit of hexadecimal constants must now be
  3144.                   in the range 0-9. A leading zero is permitted on four
  3145.                   digit hex constants, to allow fulfilling this
  3146.                   condition. (*)
  3147.  
  3148.       2.08        Configuration process expanded.  CHASM now skips over
  3149.                   perforations on printed listings.  EJECT pseudo-op
  3150.                   added.
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.                                                                      45
  3171.  
  3172.       2.07        Oops.  Configuration file now works as advertised.
  3173.  
  3174.       2.06        CHASM now supports reverse long jumps.
  3175.  
  3176.       2.05        Compiled version released.  BSAVE pseudo-op.
  3177.                   Configuration process simplified.
  3178.  
  3179.       2.04        TABs are now expanded and replaced with blanks, for
  3180.                   compatibility with IBM text editors.
  3181.  
  3182.       2.03        Two bugs corrected.  The first bug involved incorrect
  3183.                   assembly of indirect memory references which used a
  3184.                   displacement in the range 128-255.  The second caused
  3185.                   a program crash if a hex number longer than 4 digits
  3186.                   was in found in the input file.
  3187.  
  3188.       2.01        COM2DATA utility added.
  3189.  
  3190.       2.00        Corrected a bug in the DS and DB pseudo-ops which
  3191.                   caused the last label in a program to be redefined as
  3192.                   a memory location.  Also, the TAB character was added
  3193.                   as a new delimiter, and PRIMER.DOC was added to the
  3194.                   CHASM package.
  3195.  
  3196.       1.9         The short jump is now represented with mnemonic JMPS,
  3197.                   for compatibility with DEBUG version 1.1. (*)
  3198.  
  3199.       1.8         The operand type "character" was added as a new way
  3200.                   to represent immediate data.
  3201.  
  3202.       1.7         The DS operator now works for blocks larger than 255
  3203.                   bytes.  Also, the OFFSET function now works properly
  3204.                   in the displacement field of an indirect memory
  3205.                   reference.
  3206.  
  3207.       1.6         A revision of this document.  Some sections were
  3208.                   improved slightly, and in response to user requests,
  3209.                   a section on execution of assembled programs was
  3210.                   added.
  3211.  
  3212.       1.5         Corrected an error which generated the message "Data
  3213.                   too Long" if the value FFH was used as 8 bit
  3214.                   immediate data.
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.                                                                      46
  3237.  
  3238.       1.4         User interface improved.  CHASM now traps some common
  3239.                   input errors such as misspelling a file name, or
  3240.                   forgetting to turn on your printer.
  3241.  
  3242.       1.3         A speed enhancement.  Version 1.3 benchmarks about 5
  3243.                   times faster than version 1.2.
  3244.  
  3245.       As can be seen, revisions are made on a regular basis.  It is my
  3246.       policy that after once contributing, users are entitled to all
  3247.       future versions free of charge, with no further donation
  3248.       expected.  Contributing users are encouraged to send a disk and
  3249.       return mailer from time to time, to receive the most current
  3250.       version.
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.                                                                      47
  3303.  
  3304.       >>Miscellaneous and A Word From Our Sponsor...<<
  3305.  
  3306.       A. System Requirements:
  3307.  
  3308.          CHASM requires an 80 column display and at least one
  3309.          disk drive.  Memory requirements are as follows:
  3310.  
  3311.          Interpreted version, DOS 1.1  ==>  64K
  3312.          Interpreted version, DOS 2.0  ==>  96K
  3313.          Compiled version, either DOS  ==> 128K
  3314.  
  3315.       B. Programming Notes:
  3316.  
  3317.          1. CHASM is written in BASIC.  The program is heavily
  3318.             commented and very modular, so that if you'd like to see
  3319.             how an assembler works, you should read the source listing.
  3320.             CHASM's modular structure makes modification relatively
  3321.             easy, if you'd like to customize.  I'd like to hear about
  3322.             any improvements people make, for possible inclusion in
  3323.             future releases.
  3324.  
  3325.          2. If you try to modify CHASM's interpreted version, there is
  3326.             a quirk you should know about.  Most of the initialization
  3327.             code is in a "transient section" which is used once, then
  3328.             deleted to make more room for the symbol table.  Lines
  3329.             50,000 - 65529 are reserved as this transient section.
  3330.             Note Well: If you run CHASM, then save it to disk, you save
  3331.             the program WITHOUT THE INITIALIZATION CODE. The resulting
  3332.             program is non-functional. Be careful!  Keep a backup.
  3333.  
  3334.          3. CHASM.BAS will not compile directly to the EXE file
  3335.             distributed as an upgrade.  Contributors may request a copy
  3336.             the compiled version's source code by sending a formatted
  3337.             diskette and stamped, self-addressed return mailer.  Do
  3338.             *not* attempt to interpret this source file - it is not
  3339.             suitable for input to the interpreter, and a system crash
  3340.             may result if you try this.  When compiling, use the /N and
  3341.             /E options, to relax line numbering constraints and allow
  3342.             error trapping.
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.                                                                      48
  3369.  
  3370.       C. Red Tape and Legal Nonsense:
  3371.  
  3372.          1. Disclaimer:
  3373.  
  3374.             CHASM is distributed as is, with no guarantee that it will
  3375.             work correctly in all situations.  In no event will the
  3376.             Author be liable for any damages, including lost profits,
  3377.             lost savings or other incidental or consequential damages
  3378.             arising out of the use of or inability to use these
  3379.             programs, even if the Author has been advised of the
  3380.             possibility of such damages, or for any claim by any other
  3381.             party.
  3382.  
  3383.             Despite the somewhat imposing statement above, it *is* my
  3384.             intention to fix any bugs which are brought to my
  3385.             attention. Drop me a line if you think you've found a
  3386.             problem.
  3387.  
  3388.          2. Copyright Information:
  3389.  
  3390.             The entire CHASM distribution package, consisting of the
  3391.             main program, documentation files, and various data and
  3392.             utility files, is copyright (c) 1983 and 1984 by David
  3393.             Whitman.  The author reserves the exclusive right to
  3394.             distribute this package, or any part thereof, for profit.
  3395.             The name "CHASM (tm)", applied to a microcomputer assembler
  3396.             program, is a trade mark of David Whitman.
  3397.  
  3398.             The package consisting of UNCOMPILED program source code
  3399.             and the various subsidiary files may be copied freely by
  3400.             individuals for evaluation purposes.  It is expected that
  3401.             those who find the package useful will make a contribution
  3402.             directly to the author of the program.
  3403.  
  3404.             THE AUTHOR RESERVES THE EXCLUSIVE RIGHT TO DISTRIBUTE OR
  3405.             LICENSE DISTRIBUTION OF THIS PROGRAM IN COMPILED FORM.
  3406.             UNAUTHORIZED DUPLICATION OF A COMPILED VERSION OF THIS
  3407.             PROGRAM IS PUNISHABLE BY LAW.
  3408.  
  3409.             Interested manufacturers are invited to contact Whitman
  3410.             Software to discuss licensing CHASM for bundling with
  3411.             MS-DOS based computer systems.
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.                                                                      49
  3435.  
  3436.             Distribution of CHASM outside the United States is through
  3437.             licensed distributors, on a royalty basis.  Interested
  3438.             distributors are invited to contact Whitman Software.
  3439.  
  3440.          3. Royalty Information:
  3441.  
  3442.             No royalties are required to distribute programs produced
  3443.             using CHASM.  However, if you send me a copy of any major
  3444.             program you have produced using CHASM, I'll give you a free
  3445.             page of advertising in this document.
  3446.  
  3447.        D. An Offer You Can't Refuse.
  3448.  
  3449.          CHASM is distributed under a modification of the FREEWARE (tm)
  3450.          marketing scheme, developed by Andrew Fluegelman, author of
  3451.          PC-TALK, whose efforts are gratefully acknowledged.
  3452.  
  3453.          Anyone may obtain a free copy of an interpreted version of the
  3454.          program by sending a blank, formatted diskette to the author.
  3455.          An addressed, postage-paid return mailer must accompany the
  3456.          disk (no exceptions, please).
  3457.  
  3458.          A copy of the program, with documentation, will be sent by
  3459.          return mail.  The program will carry a notice suggesting
  3460.          a contribution to the program's author.  Making a contribution
  3461.          is totally voluntary on the part of the user.  Regardless of
  3462.          whether a contribution is made, the user is encouraged to
  3463.          share the program with others.  Payment for use is
  3464.          discretionary on the part of each subsequent user.
  3465.  
  3466.       The underlying philosophy here is based on three principles:
  3467.  
  3468.       First, that the value and utility of software is best assessed by
  3469.          the user on his/her own system.  Only after using a program
  3470.          can one really determine whether it serves personal
  3471.          applications, needs, and tastes.
  3472.  
  3473.       Second, that the creation of independent personal computer
  3474.          software can and should be supported by those who benefit from
  3475.          its use.  Remember the Tanstaafl principal:  There Ain't No
  3476.          Such Thing as a Free Lunch.
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.                                                                      50
  3501.  
  3502.       Finally, that copying and networking of programs should be
  3503.           encouraged, rather than restricted.  The ease with which
  3504.           software can be distributed outside traditional commercial
  3505.           channels reflects the strength, rather than the weakness, of
  3506.           electronic information.
  3507.  
  3508.       If you like this software, please help support it.  Your support
  3509.       can take three forms:
  3510.  
  3511.          1.  A monatary contribution.  $30 is suggested.
  3512.  
  3513.          2.  Suggestions, comments and bug reports.  Your comments will
  3514.              be taken seriously - user feedback was responsible for
  3515.              most of the changes listed in CHASM's revision history.
  3516.  
  3517.          3.  Spread the word.  Make copies of the interpreted version
  3518.              for friends.  Write the editor of your favorite computer
  3519.              magazine.  Advertizing costs are astronomical.  To
  3520.              continue offering CHASM this way, I need your help in
  3521.              letting other people know about CHASM.
  3522.  
  3523.       Those who make the $30 suggested payment receive the following
  3524.       benefits:
  3525.  
  3526.          1.  User support, by phone or mail.  I can only offer customer
  3527.              support to those who are in fact *customers*.  Phone
  3528.              numbers and the address for support are given on the title
  3529.              page of this manual.
  3530.  
  3531.          2.  A free upgrade to a compiled version of the program.  The
  3532.              compiled version executes much faster than the interpreted
  3533.              and supports more features.  An order form for the
  3534.              compiled version is given at the end of this manual.
  3535.  
  3536.       The compiled version is copyrighted, and users are requested NOT
  3537.       to make copies other than for their own use.  I am strongly
  3538.       opposed to copy protection, and would regret being forced to
  3539.       protect CHASM.  Please recognize the amount of time and money
  3540.       which went into producing CHASM, and respect the wishes of the
  3541.       author.
  3542.  
  3543.       David Whitman
  3544.       136 Wellington Terrace
  3545.       Lansdale, PA 19446
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.                                                                      51
  3567.  
  3568.       Appendix A: Mnemonic List
  3569.  
  3570.       This appendix lists the mnemonics which CHASM will recognize,
  3571.       grouped roughly by function.  Consult "The 8086 Book" for
  3572.       definitions of these instructions, and for the operands each will
  3573.       accept.  Mnemonics marked with an asterisk (*) will accept a 'B'
  3574.       or 'W' suffix for ambiguous memory references.  Those followed by
  3575.       a "c" in parentheses (c) are only available in CHASM's compiled
  3576.       version.
  3577.  
  3578.       Arithmetic:
  3579.  
  3580.       AAA      AAD       AAM       AAS       ADC*      ADD*      CBW
  3581.       CWD      CMP*      CMPS*     DAA       DAS       DEC*      DIV*
  3582.       IDIV*    IMUL*     INC*      MUL*      NEG*      SBB*      SUB* 
  3583.  
  3584.       Data Movement:
  3585.  
  3586.       LAHF     LDS       LEA       LES       LODS*     MOV*     MOVS*
  3587.       POP      POPF      PUSH      PUSHF     SAHF      STOS*    XCHG
  3588.       XLAT
  3589.  
  3590.       Logical:
  3591.  
  3592.       AND*     NOT*      OR*       TEST*     XOR* 
  3593.  
  3594.       String Primitives:
  3595.  
  3596.       CMPS*    LODS*     MOVS*     SCAS*     STOS*
  3597.  
  3598.       Instruction Prefixes:
  3599.  
  3600.       LOCK     REP       REPE      REPNE     REPNZ     REPZ      SEG
  3601.  
  3602.       Program Counter Control: (unconditional)
  3603.  
  3604.       CALL     CALLN     CALLF     JMP       JMPF      JMPN      JMPS
  3605.       RET
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.                                                                      52
  3633.  
  3634.       Program Counter Control: (conditional)
  3635.  
  3636.       JA       JAE      JB      JBE      JC        JCXZ       JE
  3637.       JG       JGE      JL      JLE      JNA  (c)  JNAE (c)   JNB  (c)
  3638.       JNBE (c) JNC      JNE     JNG (c)  JNGE (c)  JNL  (c)   JNLE (c)
  3639.       JNO      JNO      JNP     JNS      JNZ       JO         JP
  3640.       JPE      JPO      JS      JZ       LOOP      LOOPE      LOOPNE
  3641.       LOOPNZ   LOOPZ
  3642.  
  3643.  
  3644.       Processor Control:
  3645.  
  3646.       CLC      CLD       CLI       CMC       HLT       NOP       STC
  3647.       STD      STI       WAIT
  3648.  
  3649.       I/O:
  3650.  
  3651.       IN       OUT
  3652.  
  3653.       Interrupt:
  3654.  
  3655.       INT      INTO      IRET
  3656.  
  3657.       Rotate and Shift:
  3658.  
  3659.       RCL*     RCR*      ROL*      ROR*      SAL*      SAR*      SHL*
  3660.       SHR*
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.                                                                      53
  3699.  
  3700.       Appendix B: Differences Between CHASM and That Other Assembler
  3701.  
  3702.       Virtually all magazine articles about assembly language
  3703.       programming on the IBM PC assume that the reader is using That
  3704.       Other Assembler - you know, the one that costs $100.  This
  3705.       appendix will try to summarize the differences between the two
  3706.       programs.  Please note that I do not own a copy of That Other
  3707.       Assembler, and therefore this section is not complete, nor even
  3708.       guaranteed to be correct.  Anyone with more experience is
  3709.       invited to make additions or corrections.
  3710.  
  3711.       A. General Differences
  3712.  
  3713.       The biggest difference is philosophical.  The IBM assembler was
  3714.       designed for use by professional assembly language programmers,
  3715.       to write operating systems and other huge projects.  This is
  3716.       reflected in the large size and relative complexity of the macro
  3717.       assembler.
  3718.  
  3719.       On the other hand, CHASM was designed for use by beginners, to
  3720.       write relatively short programs.  This was done by leaving out a
  3721.       lot of the power offered by IBM's assembler, in exchange for
  3722.       simplicity and small size.  The main simplification involved
  3723.       producing object code in the COM format, rather than the EXE
  3724.       format chosen by IBM. There are two main consequences of this
  3725.       choice:
  3726.  
  3727.          1. You can't link routines assembled by CHASM to
  3728.             compiled programs. (Although you *can* include them in
  3729.             BASIC programs, interpreted or compiled.)
  3730.  
  3731.          2. Your program has to fit in one 64K segment.  If (shudder!)
  3732.             you want to write a 256K assembly language program, you're
  3733.             out of luck.
  3734.  
  3735.       Like Pascal, the IBM assembler is a strongly typed language.  By
  3736.       requiring you to specify the *type* of each memory location you
  3737.       will access in your program, the IBM assembler always knows what
  3738.       size of memory operand you want.  The disadvantage is a loss of
  3739.       freedom:  if you want to access only one byte of an area declared
  3740.       as word, that's tough. 
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.                                                                      54
  3765.  
  3766.       In analogy to the C language, CHASM is *not* strongly typed.
  3767.       CHASM is perfectly happy extracting a byte from where you
  3768.       originally set aside a word - CHASM can't tell the difference.
  3769.       The consequence of this is that you have to *tell* CHASM
  3770.       explicitly whether you want a byte or a word every time you
  3771.       access memory.  For any access to memory which doesn't have a
  3772.       register as the other operand, you must add either a 'B' or a 'W'
  3773.       to the instruction mnemonic used by IBM.
  3774.  
  3775.       B. Miscellaneous Differences:
  3776.  
  3777.          1. Short Jumps:
  3778.  
  3779.             IBM uses the SHORT keyword, CHASM uses an 'S' suffix.
  3780.             Example:
  3781.  
  3782.             JMP   SHORT label    ;ibm
  3783.             JMPS  label          ;chasm
  3784.  
  3785.          2. Offset Function:
  3786.  
  3787.             Where IBM precedes an operand with the keyword OFFSET,
  3788.             CHASM has a *function* called OFFSET. CHASM requires
  3789.             parentheses around the operand. Example:
  3790.  
  3791.             MOV   AX, OFFSET FCB  ;ibm
  3792.             MOV   AX, OFFSET(FCB) ;chasm
  3793.  
  3794.          3. Declaring Storage:
  3795.  
  3796.             A.  If you don't care what value a memory location is
  3797.                 initialized to, the IBM assembler allows you to specify
  3798.                 '?' as its contents.  CHASM figures out how many bytes
  3799.                 you are declaring by how many values you give, so you
  3800.                 have to specify a starting value for every memory
  3801.                 location you declare.  Example:
  3802.  
  3803.                 DB   ?      ;ibm
  3804.                 DB   0      ;chasm
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.                                                                      55
  3831.  
  3832.             B.  The IBM assembler has a dizzying array of storage
  3833.                 defining pseudo-ops, in keeping with its strongly typed
  3834.                 philosophy. In practice, the only ones you'll likely
  3835.                 see are DB (declare byte) and DW (declare word).  Users
  3836.                 of CHASM's interpreted version should declare two bytes
  3837.                 when you see DW in IBM syntax.  The compiled version of
  3838.                 CHASM supports DW directly.
  3839.  
  3840.                 DW     ?         ;ibm
  3841.                 DB     00H, 00H  ;interpreted chasm
  3842.                 DW     0000H     ;compiled chasm
  3843.  
  3844.             C.  The IBM assembler allows the keyword DUP as an operand
  3845.                 in storage declaring pseudo-ops.  This means to repeat
  3846.                 the definition as many times as the number just before
  3847.                 the DUP.  Example:
  3848.  
  3849.                 DW   3 DUP(?)  ;ibm
  3850.                 DB   0, 0      ;chasm
  3851.                 DB   0, 0      ;  "
  3852.                 DB   0, 0      ;  "
  3853.  
  3854.       4. Expressions:
  3855.  
  3856.          The IBM assembler allows you to perform arithmetic within the
  3857.          operand list to calculate an address or immediate operand.
  3858.          Thus, if you wanted the offset of the third byte after a
  3859.          label, you could use "label + 3" as an operand.  CHASM doesn't
  3860.          support expression evaluation.  The solution is to add labels
  3861.          to any locations accessed via an expression, then use the
  3862.          label directly.  Example:
  3863.  
  3864.                   MOV AX, BUFFER + 3   ;ibm
  3865.          BUFFER   DB  4 DUP(?)         ; "
  3866.  
  3867.                   MOV AX, BUFFER3      ;chasm
  3868.          BUFFER   DB  0, 0, 0          ;  "
  3869.          BUFFER3  DB  0                ;  "
  3870.  
  3871.          Sometimes a constant is given as an expression just to
  3872.          emphasize its origin.  For any such expressions which do not
  3873.          involve a label, just substitute the numerical value of the
  3874.          expression.
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.                                                                      56
  3897.  
  3898.        5. Segment Overrides:
  3899.  
  3900.          The IBM assembler specifies a segment override as a prefix
  3901.          attached to a memory operand.  CHASM uses a separate
  3902.          instruction, SEG, to override the default segment register for
  3903.          the following instruction.  Example:
  3904.  
  3905.          XOR  AL, ES:[DI]   ;ibm
  3906.  
  3907.          SEG  ES            ;chasm
  3908.          XOR  AL, [DI]      ;  "
  3909.  
  3910.       6. ASSUME Pseudo-op:
  3911.  
  3912.          IBM's ASSUME pseudo-op tells the assembler where the segment
  3913.          registers will be pointing.  CHASM always assumes that the CS,
  3914.          DS and SS registers point to the beginning of the code
  3915.          segment, and that the SS register has been set up to point to
  3916.          a valid stack area.  If you find an ASSUME pseudo-op where the
  3917.          CS, DS and ES registers point to different locations, you will
  3918.          have to figure out the addresses for memory references in the
  3919.          DS or ES segments yourself.
  3920.  
  3921.  
  3922.       7. Segment Pseudo-op:
  3923.  
  3924.          This pseudo-op is used to set up multiple segments in the IBM
  3925.          assembler.  Since CHASM only allows one segment, there is no
  3926.          equivalent pseudo-op.  If there is only one segment definition
  3927.          in an IBM assembler program, everything is fine, just leave
  3928.          the pseudo-op out for CHASM.
  3929.  
  3930.          Often times the SEGMENT pseudo-op is used to provide
  3931.          addressing of an area in the BIOS, or perhaps the interrupt
  3932.          vector table at the beginning of memory.  For example, if a
  3933.          program needed to get at the BIOS data area, in the IBM
  3934.          assembler you would define a dummy segment with the same
  3935.          structure as that in the BIOS listing in Technical Reference:
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.                                                                      57
  3963.  
  3964.            DATA          SEGMENT AT 40H
  3965.            RS232_BASE    DW    4 DUP(?)
  3966.            PRINTER_BASE  DW    4 DUP(?)
  3967.            EQUIP_FLAG    DW    ?
  3968.            MFG_TST       DB    ?
  3969.            MEMORY_SIZE   DW    ?
  3970.            IO_RAM_SIZE   DW    ?
  3971.  
  3972.          All this is really accomplishing is giving a name to some
  3973.          memory locations which are outside the actual program being
  3974.          written.
  3975.  
  3976.          For CHASM, you'll have to figure out the actual addresses of
  3977.          any of these data areas you want to use.  In this case, you
  3978.          can just look at the LOC column of the BIOS listing to get the
  3979.          offset of each data area.  For example, EQUIP_FLAG is at
  3980.          offset 10H (check page A-2 of Tech. Ref).  Given the
  3981.          addresses, you can give CHASM names for each of the locations,
  3982.          using the memory option of the EQU pseudo-op:
  3983.  
  3984.             RS232_BASE   EQU [00H]
  3985.             PRINTER_BASE EQU [08H]
  3986.             EQUIP_FLAG   EQU [10H]
  3987.             MFG_TEST     EQU [12H]
  3988.             MEMORY_SIZE  EQU [13H]
  3989.             IO_RAM_SIZE  EQU [15H]
  3990.  
  3991.       8. Labels:
  3992.  
  3993.          The macro assembler indicates a local label by appending a
  3994.          colon (:).  The colon does not become part of the label, and
  3995.          is not included when referencing the label.  CHASM's labels
  3996.          are all global, and although they may end with a colon, the
  3997.          colon will become part of the label itself, and must then be
  3998.          used when referencing the label.  Example:
  3999.  
  4000.          a2:   mov ax,cx      ;ibm
  4001.                jmp a2         ; "
  4002.  
  4003.          a2:   mov ax,cx      ;chasm
  4004.                jmp a2:        ;  "
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.                                                                      58
  4029.  
  4030.       9. Entry Point:
  4031.  
  4032.          The macro assembler allows you to specify the point within
  4033.          your program where execution will begin.  A label is put
  4034.          on the entry point, then to indicate entry, the same label is
  4035.          placed on the "END" pseudo-op.  Since COM programs must always
  4036.          start at offset 100H, CHASM doesn't allow setting an entry
  4037.          point.  (Also note that using the same label on two statements
  4038.          is not allowed by CHASM.)
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.                                                                      59
  4095.  
  4096.       Appendix C: Description of Files
  4097.  
  4098.       Your CHASM distribution disk contains a number of files.  This
  4099.       appendix will give a brief statement of the purpose of each.
  4100.       Files marked with '*' will not appear on the standard
  4101.       distribution disk, they are only available to contributors.
  4102.  
  4103.       FILE           DESCRIPTION
  4104.       ----------------------------------------------------------------
  4105.  
  4106.       CHASM.BAS       CHASM program, interpreted version.
  4107.  
  4108.       CHASM.BAT       Batch file to run CHASM.BAS from DOS.
  4109.  
  4110.       CHASM.CFG       Sample configuration file - for IBM printer
  4111.  
  4112.       CHASM.DAT       Data which tells CHASM how to assemble the
  4113.                       various 8088 mnemonics.
  4114.  
  4115.       CHASM128.DAT *  Expanded data for compiled version.
  4116.  
  4117.       CHASM.DOC       This document.
  4118.  
  4119.       CHASM.EXE    *  CHASM program, compiled version.
  4120.  
  4121.       CHASM.ZAP    *  Compiled version source code.
  4122.  
  4123.       CLEAR.ASM       Sample source file.
  4124.  
  4125.       COM2DATA.BAS    Utility for making BASIC subroutines.
  4126.  
  4127.       COM2DATA.DOC    Documentation for COM2DATA.
  4128.  
  4129.       COM2DATA.EXE  * Compiled version of COM2DATA.
  4130.  
  4131.       COM2DATA.ASM  * Source for DOS 2.0 filter version of COM2DATA.
  4132.  
  4133.       FREEWARE.DOC    References to other User Supported programs.
  4134.  
  4135.       PRIMER.DOC      Simple introduction to assembly language.
  4136.  
  4137.       Occasionally, various other sample source files for CHASM will be
  4138.       distributed.  These files will have extension ASM, and will be
  4139.       accompanied by a corresponding DOC file.
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.                                                                      60
  4161.  
  4162.            ********COMPILED VERSION ORDER FORM********
  4163.  
  4164.       Please copy CHASM version 3.14 onto the enclosed formatted
  4165.       disk(s).  I enclose a self-addressed, stamped mailer.  I
  4166.       understand that this compiled version of CHASM is copyrighted,
  4167.       and agree not to distribute any unauthorized copies.
  4168.  
  4169.       Diskette format:            Total Memory: _______K
  4170.  
  4171.          __ single sided
  4172.                                      (128K required)
  4173.          __ doubled sided
  4174.  
  4175.       Disks may be formatted under either DOS 1.1 or 2.0
  4176.  
  4177.       >> You must provide your own diskette and stamped, addressed
  4178.       >> return mailer.  Do NOT send money to cover these items!
  4179.  
  4180.        Please check one:
  4181.  
  4182.          __ I enclose a donation of $30 or more.
  4183.  
  4184.          __ I have already made a donation. The enclosed check brings
  4185.             my total contribution to $30 or more.
  4186.  
  4187.       Where did you hear about CHASM? ________________________________
  4188.  
  4189.       Name:    _______________________________________________________
  4190.  
  4191.       Address: _______________________________________________________
  4192.  
  4193.       City, State, Zip: ______________________________________________
  4194.  
  4195.  
  4196.       ================================================================
  4197.       Send order form, along with disk, return mailer and check to:
  4198.  
  4199.                            David Whitman
  4200.                            136 Wellington Terrace
  4201.                            Lansdale, PA 19446
  4202.  
  4203.       Your order will be expedited if you mark your envelope:
  4204.                      "VERSION 3 UPGRADE"
  4205.       ===============================================================
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.                                                                      61
  4227.  
  4228.         ==============PRINTER ENHANCEMENT===================
  4229.  
  4230.  
  4231.       Michael Hoyt, of Soft and Friendly Software, has produced a set
  4232.       of printer enhancement programs using CHASM, which is sold under
  4233.       the name Prowriter Utilities.  The package supports the following
  4234.       printers:
  4235.  
  4236.           NEC 8023A-C
  4237.           Prowriter I  (C. Itoh 8510)
  4238.           Prowriter II (C. Itoh 1550)
  4239.  
  4240.       The package contains three programs:
  4241.  
  4242.           PRINT_CHARACTERS
  4243.           PRINT_SCREEN
  4244.           PRINT_SET
  4245.  
  4246.       Once PRINT_CHARACTERS is run, it attaches itself to DOS, and
  4247.       makes your printer have exactly the same character set as your
  4248.       video monitor.  The conversion is very professionally done.
  4249.       Particularly impressive are the line drawing characters, which
  4250.       actually form connected lines, both horizontally and vertically.
  4251.  
  4252.       As if this wasn't enough, PRINT_CHARACTERS adds italics
  4253.       capability as well.  The italics make very effective emphasis in
  4254.       documents and letters, and look really good.
  4255.  
  4256.       PRINT_SCREEN is a graphics screen dump, activated by the normal
  4257.       Shift/PrtSc sequence.  Several options are available which trade
  4258.       off speed and print quality.  Since I have the mono card, I
  4259.       haven't tried PRINT_SCREEN, but Michael sent me a sample printout
  4260.       which looked quite nice.
  4261.  
  4262.       PRINT_SET is a menu-driven program to turn on and off the various
  4263.       special printing modes supported by these printers.  A simple but
  4264.       effective program.
  4265.  
  4266.       I've been using this package with my NEC 8023 for a few months
  4267.       now, and I like them quite a bit.  To get a copy, send $35 to:
  4268.  
  4269.           Soft and Friendly
  4270.           RR 2 Box 65
  4271.           Solsberry, IN 47459
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.                                                                      62
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.            ================= NEW PRODUCT ==================
  4300.  
  4301.       If you use the IBM/Microsoft BASIC compiler, chances are your
  4302.       programs are bigger and slower than they have to be.  If all
  4303.       unreferenced line numbers are removed from your source program,
  4304.       and the /N switch is used, BASCOM will "optimize" your program.
  4305.       The result is tighter, more efficient code.
  4306.  
  4307.       NUMZAP is a utility which carefully scans your source file, and
  4308.       deletes all the non-essential line numbers.  Performing this task
  4309.       by hand would be prohibitively time consuming and you'd probably
  4310.       introduce errors into your program in the process.  NUMZAP will
  4311.       do the job in minutes, 100% error free.
  4312.  
  4313.       The CHASM source file was passed through NUMZAP, and the
  4314.       resulting compiled code shrank by a factor of 10% (!).  That
  4315.       10% reduction could make the difference between your program
  4316.       running in 64K, or having users with minimal systems get "Out of
  4317.       Memory" messages just before your program crashes.
  4318.  
  4319.       An added advantage to using NUMZAP is that bigger programs can be
  4320.       compiled.  You may not be aware that there is a limit on the size
  4321.       of program which the compiler can handle.  BASCOM uses up space
  4322.       remembering the offset of each line number in your program. If
  4323.       you have too many numbered lines, BASCOM will run out of room and
  4324.       you'll get a unending series of "TC" (Too Complex) error
  4325.       messages.  By eliminating the unneeded line numbers, you give
  4326.       BASCOM more elbow room.  The free space available to compile
  4327.       CHASM increased 27% (!) after using NUMZAP.
  4328.  
  4329.       NUMZAP is available under the standard FREEWARE deal - just send
  4330.       a formatted disk and self-addressed, stamped return mailer to:
  4331.  
  4332.                   David Whitman
  4333.                   136 Wellington Terrace
  4334.                   Lansdale, PA 19446
  4335.  
  4336.       Be sure to specify that you are interested in NUMZAP.  If you
  4337.       like the program, a donation of $15 is suggested.
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.